You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by sh...@apache.org on 2017/06/25 02:06:24 UTC
[02/47] lucene-solr:feature/autoscaling: LUCENE-7872:
TopDocs.totalHits is now a long.
LUCENE-7872: TopDocs.totalHits is now a long.
Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/44d1f1fe
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/44d1f1fe
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/44d1f1fe
Branch: refs/heads/feature/autoscaling
Commit: 44d1f1fe3fe2bdc0210d065965eb30bc467623ca
Parents: 2d26d7e
Author: Adrien Grand <jp...@gmail.com>
Authored: Wed Jun 21 09:55:02 2017 +0200
Committer: Adrien Grand <jp...@gmail.com>
Committed: Wed Jun 21 09:55:02 2017 +0200
----------------------------------------------------------------------
lucene/CHANGES.txt | 2 ++
lucene/MIGRATE.txt | 10 ++++++++++
.../lucene/classification/utils/DatasetSplitter.java | 2 +-
.../src/java/org/apache/lucene/search/TopDocs.java | 8 ++++----
.../java/org/apache/lucene/search/TopFieldDocs.java | 2 +-
.../test/org/apache/lucene/index/Test2BTerms.java | 2 +-
.../apache/lucene/index/TestIndexWriterDelete.java | 10 +++++-----
.../apache/lucene/index/TestIndexWriterReader.java | 6 +++---
.../test/org/apache/lucene/index/TestManyFields.java | 2 +-
.../org/apache/lucene/search/TestAutomatonQuery.java | 2 +-
.../lucene/search/TestAutomatonQueryUnicode.java | 2 +-
.../test/org/apache/lucene/search/TestBooleanOr.java | 2 +-
.../org/apache/lucene/search/TestLRUQueryCache.java | 2 +-
.../org/apache/lucene/search/TestRegexpQuery.java | 2 +-
.../org/apache/lucene/search/TestTermRangeQuery.java | 4 ++--
.../org/apache/lucene/search/spans/TestSpans.java | 2 +-
.../src/java/org/apache/lucene/demo/SearchFiles.java | 2 +-
.../org/apache/lucene/search/grouping/GroupDocs.java | 4 ++--
.../lucene/queryparser/classic/TestQueryParser.java | 2 +-
.../lucene/queryparser/xml/TestCoreParser.java | 2 +-
.../queryparser/xml/TestQueryTemplateManager.java | 2 +-
.../lucene/replicator/nrt/SimpleReplicaNode.java | 4 ++--
.../org/apache/lucene/spatial/SpatialExample.java | 2 +-
.../org/apache/lucene/spatial/SpatialTestCase.java | 4 ++--
.../search/suggest/document/TestSuggestField.java | 6 +++---
.../index/ThreadedIndexingAndSearchingTestCase.java | 9 +++++----
.../src/java/org/apache/solr/ltr/LTRRescorer.java | 2 +-
.../java/org/apache/solr/cloud/RecoveryStrategy.java | 4 ++--
.../solr/handler/component/SpellCheckComponent.java | 8 ++++----
.../src/java/org/apache/solr/search/DocList.java | 2 +-
.../src/java/org/apache/solr/search/DocSlice.java | 6 +++---
.../src/java/org/apache/solr/search/Grouping.java | 2 +-
.../TopGroupsResultTransformer.java | 10 +++++-----
.../apache/solr/spelling/SpellCheckCollation.java | 6 +++---
.../org/apache/solr/spelling/SpellCheckCollator.java | 6 +++---
.../test/org/apache/solr/search/TestRangeQuery.java | 4 ++--
.../apache/solr/spelling/SpellCheckCollatorTest.java | 15 +++++++--------
.../client/solrj/response/SpellCheckResponse.java | 2 +-
38 files changed, 88 insertions(+), 76 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/44d1f1fe/lucene/CHANGES.txt
----------------------------------------------------------------------
diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txt
index 1f53d68..d695310 100644
--- a/lucene/CHANGES.txt
+++ b/lucene/CHANGES.txt
@@ -74,6 +74,8 @@ API Changes
was optimized to work directly instead of being implemented on getFields.
(David Smiley)
+* LUCENE-7872: TopDocs.totalHits is now a long. (Adrien Grand, hossman)
+
Bug Fixes
* LUCENE-7626: IndexWriter will no longer accept broken token offsets
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/44d1f1fe/lucene/MIGRATE.txt
----------------------------------------------------------------------
diff --git a/lucene/MIGRATE.txt b/lucene/MIGRATE.txt
index 117b49c..10ce4bc 100644
--- a/lucene/MIGRATE.txt
+++ b/lucene/MIGRATE.txt
@@ -121,3 +121,13 @@ use TopGroupsCollector.
Support for legacy numerics has been removed since legacy numerics had been
deprecated since Lucene 6.0. Points should be used instead, see
org.apache.lucene.index.PointValues for an introduction.
+
+## TopDocs.totalHits is now a long (LUCENE-7872)
+
+TopDocs.totalHits is now a long so that TopDocs instances can be used to
+represent top hits that have more than 2B matches. This is necessary for the
+case that multiple TopDocs instances are merged together with TopDocs#merge as
+they might have more than 2B matches in total. However TopDocs instances
+returned by IndexSearcher will still have a total number of hits which is less
+than 2B since Lucene indexes are still bound to at most 2B documents, so it
+can safely be casted to an int in that case.
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/44d1f1fe/lucene/classification/src/java/org/apache/lucene/classification/utils/DatasetSplitter.java
----------------------------------------------------------------------
diff --git a/lucene/classification/src/java/org/apache/lucene/classification/utils/DatasetSplitter.java b/lucene/classification/src/java/org/apache/lucene/classification/utils/DatasetSplitter.java
index 913fb7f..d75daf9 100644
--- a/lucene/classification/src/java/org/apache/lucene/classification/utils/DatasetSplitter.java
+++ b/lucene/classification/src/java/org/apache/lucene/classification/utils/DatasetSplitter.java
@@ -122,7 +122,7 @@ public class DatasetSplitter {
// iterate over existing documents
for (GroupDocs<Object> group : topGroups.groups) {
- int totalHits = group.totalHits;
+ long totalHits = group.totalHits;
double testSize = totalHits * testRatio;
int tc = 0;
double cvSize = totalHits * crossValidationRatio;
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/44d1f1fe/lucene/core/src/java/org/apache/lucene/search/TopDocs.java
----------------------------------------------------------------------
diff --git a/lucene/core/src/java/org/apache/lucene/search/TopDocs.java b/lucene/core/src/java/org/apache/lucene/search/TopDocs.java
index 3b66fca..c1a4ca6 100644
--- a/lucene/core/src/java/org/apache/lucene/search/TopDocs.java
+++ b/lucene/core/src/java/org/apache/lucene/search/TopDocs.java
@@ -23,7 +23,7 @@ import org.apache.lucene.util.PriorityQueue;
public class TopDocs {
/** The total number of hits for the query. */
- public int totalHits;
+ public long totalHits;
/** The top hits for the query. */
public ScoreDoc[] scoreDocs;
@@ -45,11 +45,11 @@ public class TopDocs {
}
/** Constructs a TopDocs with a default maxScore=Float.NaN. */
- TopDocs(int totalHits, ScoreDoc[] scoreDocs) {
+ TopDocs(long totalHits, ScoreDoc[] scoreDocs) {
this(totalHits, scoreDocs, Float.NaN);
}
- public TopDocs(int totalHits, ScoreDoc[] scoreDocs, float maxScore) {
+ public TopDocs(long totalHits, ScoreDoc[] scoreDocs, float maxScore) {
this.totalHits = totalHits;
this.scoreDocs = scoreDocs;
this.maxScore = maxScore;
@@ -266,7 +266,7 @@ public class TopDocs {
queue = new MergeSortQueue(sort, shardHits);
}
- int totalHitCount = 0;
+ long totalHitCount = 0;
int availHitCount = 0;
float maxScore = Float.MIN_VALUE;
for(int shardIDX=0;shardIDX<shardHits.length;shardIDX++) {
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/44d1f1fe/lucene/core/src/java/org/apache/lucene/search/TopFieldDocs.java
----------------------------------------------------------------------
diff --git a/lucene/core/src/java/org/apache/lucene/search/TopFieldDocs.java b/lucene/core/src/java/org/apache/lucene/search/TopFieldDocs.java
index af187f3..52a51b7 100644
--- a/lucene/core/src/java/org/apache/lucene/search/TopFieldDocs.java
+++ b/lucene/core/src/java/org/apache/lucene/search/TopFieldDocs.java
@@ -32,7 +32,7 @@ public class TopFieldDocs extends TopDocs {
* @param fields The sort criteria used to find the top hits.
* @param maxScore The maximum score encountered.
*/
- public TopFieldDocs (int totalHits, ScoreDoc[] scoreDocs, SortField[] fields, float maxScore) {
+ public TopFieldDocs (long totalHits, ScoreDoc[] scoreDocs, SortField[] fields, float maxScore) {
super (totalHits, scoreDocs, maxScore);
this.fields = fields;
}
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/44d1f1fe/lucene/core/src/test/org/apache/lucene/index/Test2BTerms.java
----------------------------------------------------------------------
diff --git a/lucene/core/src/test/org/apache/lucene/index/Test2BTerms.java b/lucene/core/src/test/org/apache/lucene/index/Test2BTerms.java
index 22d1234..2e962b6 100644
--- a/lucene/core/src/test/org/apache/lucene/index/Test2BTerms.java
+++ b/lucene/core/src/test/org/apache/lucene/index/Test2BTerms.java
@@ -261,7 +261,7 @@ public class Test2BTerms extends LuceneTestCase {
final BytesRef term = terms.get(random().nextInt(terms.size()));
System.out.println("TEST: search " + term);
final long t0 = System.currentTimeMillis();
- final int count = s.search(new TermQuery(new Term("field", term)), 1).totalHits;
+ final long count = s.search(new TermQuery(new Term("field", term)), 1).totalHits;
if (count <= 0) {
System.out.println(" FAILED: count=" + count);
failed = true;
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/44d1f1fe/lucene/core/src/test/org/apache/lucene/index/TestIndexWriterDelete.java
----------------------------------------------------------------------
diff --git a/lucene/core/src/test/org/apache/lucene/index/TestIndexWriterDelete.java b/lucene/core/src/test/org/apache/lucene/index/TestIndexWriterDelete.java
index 25817d9..975f5f0 100644
--- a/lucene/core/src/test/org/apache/lucene/index/TestIndexWriterDelete.java
+++ b/lucene/core/src/test/org/apache/lucene/index/TestIndexWriterDelete.java
@@ -76,7 +76,7 @@ public class TestIndexWriterDelete extends LuceneTestCase {
modifier.commit();
Term term = new Term("city", "Amsterdam");
- int hitCount = getHitCount(dir, term);
+ long hitCount = getHitCount(dir, term);
assertEquals(1, hitCount);
if (VERBOSE) {
System.out.println("\nTEST: now delete by term=" + term);
@@ -177,7 +177,7 @@ public class TestIndexWriterDelete extends LuceneTestCase {
IndexReader reader = DirectoryReader.open(dir);
assertEquals(1, reader.numDocs());
- int hitCount = getHitCount(dir, new Term("id", String.valueOf(id)));
+ long hitCount = getHitCount(dir, new Term("id", String.valueOf(id)));
assertEquals(1, hitCount);
reader.close();
modifier.close();
@@ -470,10 +470,10 @@ public class TestIndexWriterDelete extends LuceneTestCase {
modifier.addDocument(doc);
}
- private int getHitCount(Directory dir, Term term) throws IOException {
+ private long getHitCount(Directory dir, Term term) throws IOException {
IndexReader reader = DirectoryReader.open(dir);
IndexSearcher searcher = newSearcher(reader);
- int hitCount = searcher.search(new TermQuery(term), 1000).totalHits;
+ long hitCount = searcher.search(new TermQuery(term), 1000).totalHits;
reader.close();
return hitCount;
}
@@ -802,7 +802,7 @@ public class TestIndexWriterDelete extends LuceneTestCase {
// one of the two files hits
Term term = new Term("city", "Amsterdam");
- int hitCount = getHitCount(dir, term);
+ long hitCount = getHitCount(dir, term);
assertEquals(1, hitCount);
// open the writer again (closed above)
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/44d1f1fe/lucene/core/src/test/org/apache/lucene/index/TestIndexWriterReader.java
----------------------------------------------------------------------
diff --git a/lucene/core/src/test/org/apache/lucene/index/TestIndexWriterReader.java b/lucene/core/src/test/org/apache/lucene/index/TestIndexWriterReader.java
index 584e03c..f8abc82 100644
--- a/lucene/core/src/test/org/apache/lucene/index/TestIndexWriterReader.java
+++ b/lucene/core/src/test/org/apache/lucene/index/TestIndexWriterReader.java
@@ -768,7 +768,7 @@ public class TestIndexWriterReader extends LuceneTestCase {
threads[i].start();
}
- int lastCount = 0;
+ long lastCount = 0;
while(threadDone.get() == false) {
DirectoryReader r2 = DirectoryReader.openIfChanged(r);
if (r2 != null) {
@@ -776,7 +776,7 @@ public class TestIndexWriterReader extends LuceneTestCase {
r = r2;
Query q = new TermQuery(new Term("indexname", "test"));
IndexSearcher searcher = newSearcher(r);
- final int count = searcher.search(q, 10).totalHits;
+ final long count = searcher.search(q, 10).totalHits;
assertTrue(count >= lastCount);
lastCount = count;
}
@@ -793,7 +793,7 @@ public class TestIndexWriterReader extends LuceneTestCase {
}
Query q = new TermQuery(new Term("indexname", "test"));
IndexSearcher searcher = newSearcher(r);
- final int count = searcher.search(q, 10).totalHits;
+ final long count = searcher.search(q, 10).totalHits;
assertTrue(count >= lastCount);
assertEquals(0, excs.size());
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/44d1f1fe/lucene/core/src/test/org/apache/lucene/index/TestManyFields.java
----------------------------------------------------------------------
diff --git a/lucene/core/src/test/org/apache/lucene/index/TestManyFields.java b/lucene/core/src/test/org/apache/lucene/index/TestManyFields.java
index 9b2f732..bcb8cd8 100644
--- a/lucene/core/src/test/org/apache/lucene/index/TestManyFields.java
+++ b/lucene/core/src/test/org/apache/lucene/index/TestManyFields.java
@@ -107,7 +107,7 @@ public class TestManyFields extends LuceneTestCase {
IndexReader reader = DirectoryReader.open(dir);
IndexSearcher searcher = newSearcher(reader);
- int totalHits = searcher.search(new TermQuery(new Term("field", "aaa")), 1).totalHits;
+ long totalHits = searcher.search(new TermQuery(new Term("field", "aaa")), 1).totalHits;
assertEquals(n*100, totalHits);
reader.close();
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/44d1f1fe/lucene/core/src/test/org/apache/lucene/search/TestAutomatonQuery.java
----------------------------------------------------------------------
diff --git a/lucene/core/src/test/org/apache/lucene/search/TestAutomatonQuery.java b/lucene/core/src/test/org/apache/lucene/search/TestAutomatonQuery.java
index 3da69f0..cfb1f5b 100644
--- a/lucene/core/src/test/org/apache/lucene/search/TestAutomatonQuery.java
+++ b/lucene/core/src/test/org/apache/lucene/search/TestAutomatonQuery.java
@@ -85,7 +85,7 @@ public class TestAutomatonQuery extends LuceneTestCase {
return new Term(FN, value);
}
- private int automatonQueryNrHits(AutomatonQuery query) throws IOException {
+ private long automatonQueryNrHits(AutomatonQuery query) throws IOException {
if (VERBOSE) {
System.out.println("TEST: run aq=" + query);
}
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/44d1f1fe/lucene/core/src/test/org/apache/lucene/search/TestAutomatonQueryUnicode.java
----------------------------------------------------------------------
diff --git a/lucene/core/src/test/org/apache/lucene/search/TestAutomatonQueryUnicode.java b/lucene/core/src/test/org/apache/lucene/search/TestAutomatonQueryUnicode.java
index 2af3098..4817036 100644
--- a/lucene/core/src/test/org/apache/lucene/search/TestAutomatonQueryUnicode.java
+++ b/lucene/core/src/test/org/apache/lucene/search/TestAutomatonQueryUnicode.java
@@ -94,7 +94,7 @@ public class TestAutomatonQueryUnicode extends LuceneTestCase {
return new Term(FN, value);
}
- private int automatonQueryNrHits(AutomatonQuery query) throws IOException {
+ private long automatonQueryNrHits(AutomatonQuery query) throws IOException {
return searcher.search(query, 5).totalHits;
}
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/44d1f1fe/lucene/core/src/test/org/apache/lucene/search/TestBooleanOr.java
----------------------------------------------------------------------
diff --git a/lucene/core/src/test/org/apache/lucene/search/TestBooleanOr.java b/lucene/core/src/test/org/apache/lucene/search/TestBooleanOr.java
index 4e232c4..e95ffa4 100644
--- a/lucene/core/src/test/org/apache/lucene/search/TestBooleanOr.java
+++ b/lucene/core/src/test/org/apache/lucene/search/TestBooleanOr.java
@@ -51,7 +51,7 @@ public class TestBooleanOr extends LuceneTestCase {
private IndexReader reader;
- private int search(Query q) throws IOException {
+ private long search(Query q) throws IOException {
QueryUtils.check(random(), q,searcher);
return searcher.search(q, 1000).totalHits;
}
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/44d1f1fe/lucene/core/src/test/org/apache/lucene/search/TestLRUQueryCache.java
----------------------------------------------------------------------
diff --git a/lucene/core/src/test/org/apache/lucene/search/TestLRUQueryCache.java b/lucene/core/src/test/org/apache/lucene/search/TestLRUQueryCache.java
index 4e80f9e..e13f9e0 100644
--- a/lucene/core/src/test/org/apache/lucene/search/TestLRUQueryCache.java
+++ b/lucene/core/src/test/org/apache/lucene/search/TestLRUQueryCache.java
@@ -142,7 +142,7 @@ public class TestLRUQueryCache extends LuceneTestCase {
TotalHitCountCollector collector = new TotalHitCountCollector();
searcher.search(q, collector); // will use the cache
final int totalHits1 = collector.getTotalHits();
- final int totalHits2 = searcher.search(q, 1).totalHits; // will not use the cache because of scores
+ final long totalHits2 = searcher.search(q, 1).totalHits; // will not use the cache because of scores
assertEquals(totalHits2, totalHits1);
} finally {
mgr.release(searcher);
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/44d1f1fe/lucene/core/src/test/org/apache/lucene/search/TestRegexpQuery.java
----------------------------------------------------------------------
diff --git a/lucene/core/src/test/org/apache/lucene/search/TestRegexpQuery.java b/lucene/core/src/test/org/apache/lucene/search/TestRegexpQuery.java
index 505b26f..ad1319b 100644
--- a/lucene/core/src/test/org/apache/lucene/search/TestRegexpQuery.java
+++ b/lucene/core/src/test/org/apache/lucene/search/TestRegexpQuery.java
@@ -68,7 +68,7 @@ public class TestRegexpQuery extends LuceneTestCase {
return new Term(FN, value);
}
- private int regexQueryNrHits(String regex) throws IOException {
+ private long regexQueryNrHits(String regex) throws IOException {
RegexpQuery query = new RegexpQuery(newTerm(regex));
return searcher.search(query, 5).totalHits;
}
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/44d1f1fe/lucene/core/src/test/org/apache/lucene/search/TestTermRangeQuery.java
----------------------------------------------------------------------
diff --git a/lucene/core/src/test/org/apache/lucene/search/TestTermRangeQuery.java b/lucene/core/src/test/org/apache/lucene/search/TestTermRangeQuery.java
index 97b0405..be59eb9 100644
--- a/lucene/core/src/test/org/apache/lucene/search/TestTermRangeQuery.java
+++ b/lucene/core/src/test/org/apache/lucene/search/TestTermRangeQuery.java
@@ -271,7 +271,7 @@ public class TestTermRangeQuery extends LuceneTestCase {
initializeIndex(new String[] {"A", "B", "", "C", "D"}, analyzer);
IndexReader reader = DirectoryReader.open(dir);
IndexSearcher searcher = newSearcher(reader);
- int numHits = searcher.search(query, 1000).totalHits;
+ long numHits = searcher.search(query, 1000).totalHits;
// When Lucene-38 is fixed, use the assert on the next line:
assertEquals("A,B,<empty string>,C,D => A, B & <empty string> are in range", 3, numHits);
// until Lucene-38 is fixed, use this assert:
@@ -306,7 +306,7 @@ public class TestTermRangeQuery extends LuceneTestCase {
initializeIndex(new String[]{"A", "B", "","C", "D"}, analyzer);
IndexReader reader = DirectoryReader.open(dir);
IndexSearcher searcher = newSearcher(reader);
- int numHits = searcher.search(query, 1000).totalHits;
+ long numHits = searcher.search(query, 1000).totalHits;
// When Lucene-38 is fixed, use the assert on the next line:
assertEquals("A,B,<empty string>,C,D => A,B,<empty string>,C in range", 4, numHits);
// until Lucene-38 is fixed, use this assert
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/44d1f1fe/lucene/core/src/test/org/apache/lucene/search/spans/TestSpans.java
----------------------------------------------------------------------
diff --git a/lucene/core/src/test/org/apache/lucene/search/spans/TestSpans.java b/lucene/core/src/test/org/apache/lucene/search/spans/TestSpans.java
index 2b5b919..4a7125b 100644
--- a/lucene/core/src/test/org/apache/lucene/search/spans/TestSpans.java
+++ b/lucene/core/src/test/org/apache/lucene/search/spans/TestSpans.java
@@ -333,7 +333,7 @@ public class TestSpans extends LuceneTestCase {
}
// LUCENE-1404
- private int hitCount(IndexSearcher searcher, String word) throws Throwable {
+ private long hitCount(IndexSearcher searcher, String word) throws Throwable {
return searcher.search(new TermQuery(new Term("text", word)), 10).totalHits;
}
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/44d1f1fe/lucene/demo/src/java/org/apache/lucene/demo/SearchFiles.java
----------------------------------------------------------------------
diff --git a/lucene/demo/src/java/org/apache/lucene/demo/SearchFiles.java b/lucene/demo/src/java/org/apache/lucene/demo/SearchFiles.java
index 46c75e1..a7a6fee 100644
--- a/lucene/demo/src/java/org/apache/lucene/demo/SearchFiles.java
+++ b/lucene/demo/src/java/org/apache/lucene/demo/SearchFiles.java
@@ -152,7 +152,7 @@ public class SearchFiles {
TopDocs results = searcher.search(query, 5 * hitsPerPage);
ScoreDoc[] hits = results.scoreDocs;
- int numTotalHits = results.totalHits;
+ int numTotalHits = Math.toIntExact(results.totalHits);
System.out.println(numTotalHits + " total matching documents");
int start = 0;
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/44d1f1fe/lucene/grouping/src/java/org/apache/lucene/search/grouping/GroupDocs.java
----------------------------------------------------------------------
diff --git a/lucene/grouping/src/java/org/apache/lucene/search/grouping/GroupDocs.java b/lucene/grouping/src/java/org/apache/lucene/search/grouping/GroupDocs.java
index 48f12aa..a2213d9 100644
--- a/lucene/grouping/src/java/org/apache/lucene/search/grouping/GroupDocs.java
+++ b/lucene/grouping/src/java/org/apache/lucene/search/grouping/GroupDocs.java
@@ -39,7 +39,7 @@ public class GroupDocs<T> {
public final ScoreDoc[] scoreDocs;
/** Total hits within this group */
- public final int totalHits;
+ public final long totalHits;
/** Matches the groupSort passed to {@link
* FirstPassGroupingCollector}. */
@@ -47,7 +47,7 @@ public class GroupDocs<T> {
public GroupDocs(float score,
float maxScore,
- int totalHits,
+ long totalHits,
ScoreDoc[] scoreDocs,
T groupValue,
Object[] groupSortValues) {
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/44d1f1fe/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 17107fc..6b1a6aa 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);
- int hits = is.search(q, 10).totalHits;
+ long hits = is.search(q, 10).totalHits;
ir.close();
ramDir.close();
if (hits == 1){
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/44d1f1fe/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 8f07c4a..11ffda6 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
@@ -105,7 +105,7 @@ public class TestCoreParser extends LuceneTestCase {
public void testCustomFieldUserQueryXML() throws ParserException, IOException {
Query q = parse("UserInputQueryCustomField.xml");
- int h = searcher().search(q, 1000).totalHits;
+ long h = searcher().search(q, 1000).totalHits;
assertEquals("UserInputQueryCustomField should produce 0 result ", 0, h);
}
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/44d1f1fe/lucene/queryparser/src/test/org/apache/lucene/queryparser/xml/TestQueryTemplateManager.java
----------------------------------------------------------------------
diff --git a/lucene/queryparser/src/test/org/apache/lucene/queryparser/xml/TestQueryTemplateManager.java b/lucene/queryparser/src/test/org/apache/lucene/queryparser/xml/TestQueryTemplateManager.java
index 4c2e34a..5ee693f 100644
--- a/lucene/queryparser/src/test/org/apache/lucene/queryparser/xml/TestQueryTemplateManager.java
+++ b/lucene/queryparser/src/test/org/apache/lucene/queryparser/xml/TestQueryTemplateManager.java
@@ -93,7 +93,7 @@ public class TestQueryTemplateManager extends LuceneTestCase {
Query q = builder.getQuery(doc.getDocumentElement());
//Run the query
- int h = searcher.search(q, 1000).totalHits;
+ long h = searcher.search(q, 1000).totalHits;
//Check we have the expected number of results
int expectedHits = Integer.parseInt(queryFormProperties.getProperty("expectedMatches"));
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/44d1f1fe/lucene/replicator/src/test/org/apache/lucene/replicator/nrt/SimpleReplicaNode.java
----------------------------------------------------------------------
diff --git a/lucene/replicator/src/test/org/apache/lucene/replicator/nrt/SimpleReplicaNode.java b/lucene/replicator/src/test/org/apache/lucene/replicator/nrt/SimpleReplicaNode.java
index c394c65..874b568 100644
--- a/lucene/replicator/src/test/org/apache/lucene/replicator/nrt/SimpleReplicaNode.java
+++ b/lucene/replicator/src/test/org/apache/lucene/replicator/nrt/SimpleReplicaNode.java
@@ -212,7 +212,7 @@ class SimpleReplicaNode extends ReplicaNode {
IndexSearcher searcher = mgr.acquire();
try {
long version = ((DirectoryReader) searcher.getIndexReader()).getVersion();
- int hitCount = searcher.search(new TermQuery(new Term("body", "the")), 1).totalHits;
+ int hitCount = searcher.count(new TermQuery(new Term("body", "the")));
//node.message("version=" + version + " searcher=" + searcher);
out.writeVLong(version);
out.writeVInt(hitCount);
@@ -229,7 +229,7 @@ class SimpleReplicaNode extends ReplicaNode {
IndexSearcher searcher = mgr.acquire();
try {
long version = ((DirectoryReader) searcher.getIndexReader()).getVersion();
- int hitCount = searcher.search(new MatchAllDocsQuery(), 1).totalHits;
+ int hitCount = searcher.count(new MatchAllDocsQuery());
//node.message("version=" + version + " searcher=" + searcher);
out.writeVLong(version);
out.writeVInt(hitCount);
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/44d1f1fe/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 76e0200..1faae21 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
@@ -190,7 +190,7 @@ public class SpatialExample extends LuceneTestCase {
}
private void assertDocMatchedIds(IndexSearcher indexSearcher, TopDocs docs, int... ids) throws IOException {
- int[] gotIds = new int[docs.totalHits];
+ int[] gotIds = new int[Math.toIntExact(docs.totalHits)];
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/44d1f1fe/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 9f4ba02..0b268d9 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
@@ -205,10 +205,10 @@ public abstract class SpatialTestCase extends LuceneTestCase {
protected static class SearchResults {
- public int numFound;
+ public long numFound;
public List<SearchResult> results;
- public SearchResults(int numFound, List<SearchResult> results) {
+ public SearchResults(long numFound, List<SearchResult> results) {
this.numFound = numFound;
this.results = results;
}
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/44d1f1fe/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 3efb50d..a797ca5 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
@@ -126,7 +126,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(0));
+ assertThat(lookupDocs.totalHits, equalTo(0L));
reader.close();
iw.close();
}
@@ -470,7 +470,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(0));
+ assertThat(suggest.totalHits, equalTo(0L));
reader.close();
iw.close();
}
@@ -498,7 +498,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(0));
+ assertThat(suggest.totalHits, equalTo(0L));
reader.close();
iw.close();
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/44d1f1fe/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 fa9d510..3d97004 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
@@ -31,6 +31,7 @@ import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
+import java.util.concurrent.atomic.AtomicLong;
import org.apache.lucene.analysis.MockAnalyzer;
import org.apache.lucene.document.Document;
@@ -323,7 +324,7 @@ public abstract class ThreadedIndexingAndSearchingTestCase extends LuceneTestCas
protected void runSearchThreads(final long stopTimeMS) throws Exception {
final int numThreads = TestUtil.nextInt(random(), 1, 5);
final Thread[] searchThreads = new Thread[numThreads];
- final AtomicInteger totHits = new AtomicInteger();
+ final AtomicLong totHits = new AtomicLong();
// silly starting guess:
final AtomicInteger totTermCount = new AtomicInteger(100);
@@ -664,11 +665,11 @@ public abstract class ThreadedIndexingAndSearchingTestCase extends LuceneTestCas
}
}
- private int runQuery(IndexSearcher s, Query q) throws Exception {
+ private long runQuery(IndexSearcher s, Query q) throws Exception {
s.search(q, 10);
- int 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;
final Sort dvSort = new Sort(new SortField("titleDV", SortField.Type.STRING));
- int hitCount2 = s.search(q, 10, dvSort).totalHits;
+ long hitCount2 = s.search(q, 10, dvSort).totalHits;
assertEquals(hitCount, hitCount2);
return hitCount;
}
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/44d1f1fe/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 818d861..33c9a36 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
@@ -110,7 +110,7 @@ public class LTRRescorer extends Rescorer {
}
});
- topN = Math.min(topN, firstPassTopDocs.totalHits);
+ topN = Math.toIntExact(Math.min(topN, firstPassTopDocs.totalHits));
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/44d1f1fe/solr/core/src/java/org/apache/solr/cloud/RecoveryStrategy.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/cloud/RecoveryStrategy.java b/solr/core/src/java/org/apache/solr/cloud/RecoveryStrategy.java
index 3449935..9b0805f 100644
--- a/solr/core/src/java/org/apache/solr/cloud/RecoveryStrategy.java
+++ b/solr/core/src/java/org/apache/solr/cloud/RecoveryStrategy.java
@@ -234,7 +234,7 @@ public class RecoveryStrategy implements Runnable, Closeable {
LOG.debug(core.getCoreContainer()
.getZkController().getNodeName()
+ " replicated "
- + searcher.search(new MatchAllDocsQuery(), 1).totalHits
+ + searcher.count(new MatchAllDocsQuery())
+ " from "
+ leaderUrl
+ " gen:"
@@ -781,7 +781,7 @@ public class RecoveryStrategy implements Runnable, Closeable {
RefCounted<SolrIndexSearcher> searchHolder = core.getNewestSearcher(false);
SolrIndexSearcher searcher = searchHolder.get();
try {
- final int totalHits = searcher.search(new MatchAllDocsQuery(), 1).totalHits;
+ final int totalHits = searcher.count(new MatchAllDocsQuery());
final String nodeName = core.getCoreContainer().getZkController().getNodeName();
LOG.debug("[{}] {} [{} total hits]", nodeName, op, totalHits);
} finally {
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/44d1f1fe/solr/core/src/java/org/apache/solr/handler/component/SpellCheckComponent.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/handler/component/SpellCheckComponent.java b/solr/core/src/java/org/apache/solr/handler/component/SpellCheckComponent.java
index eee36cc..6aba296 100644
--- a/solr/core/src/java/org/apache/solr/handler/component/SpellCheckComponent.java
+++ b/solr/core/src/java/org/apache/solr/handler/component/SpellCheckComponent.java
@@ -171,12 +171,12 @@ public class SpellCheckComponent extends SearchComponent implements SolrCoreAwar
customParams.add(getCustomParams(checkerName, params));
}
- Integer hitsInteger = (Integer) rb.rsp.getToLog().get("hits");
+ Number hitsLong = (Number) rb.rsp.getToLog().get("hits");
long hits = 0;
- if (hitsInteger == null) {
+ if (hitsLong == null) {
hits = rb.getNumberDocumentsFound();
} else {
- hits = hitsInteger.longValue();
+ hits = hitsLong.longValue();
}
SpellingResult spellingResult = null;
@@ -543,7 +543,7 @@ public class SpellCheckComponent extends SearchComponent implements SolrCoreAwar
NamedList expandedCollation = (NamedList) o;
SpellCheckCollation coll = new SpellCheckCollation();
coll.setCollationQuery((String) expandedCollation.get("collationQuery"));
- coll.setHits((Integer) expandedCollation.get("hits"));
+ coll.setHits(((Number) expandedCollation.get("hits")).longValue());
if(maxCollationTries>0)
{
coll.setInternalRank((Integer) expandedCollation.get("collationInternalRank"));
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/44d1f1fe/solr/core/src/java/org/apache/solr/search/DocList.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/search/DocList.java b/solr/core/src/java/org/apache/solr/search/DocList.java
index 41f892a..fee2c13 100644
--- a/solr/core/src/java/org/apache/solr/search/DocList.java
+++ b/solr/core/src/java/org/apache/solr/search/DocList.java
@@ -45,7 +45,7 @@ public interface DocList extends DocSet {
* Hence it's always true that matches() >= size()
* @return number of matches for the search(query & any filters)
*/
- public int matches();
+ public long matches();
/***
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/44d1f1fe/solr/core/src/java/org/apache/solr/search/DocSlice.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/search/DocSlice.java b/solr/core/src/java/org/apache/solr/search/DocSlice.java
index 98de307..0b33ae9 100644
--- a/solr/core/src/java/org/apache/solr/search/DocSlice.java
+++ b/solr/core/src/java/org/apache/solr/search/DocSlice.java
@@ -36,7 +36,7 @@ public class DocSlice extends DocSetBase implements DocList {
final int[] docs; // a slice of documents (docs 0-100 of the query)
final float[] scores; // optional score list
- final int matches;
+ final long matches;
final float maxScore;
/**
@@ -48,7 +48,7 @@ public class DocSlice extends DocSetBase implements DocList {
* @param scores array of scores that corresponds to docs, may be null
* @param matches total number of matches for the query
*/
- public DocSlice(int offset, int len, int[] docs, float[] scores, int matches, float maxScore) {
+ public DocSlice(int offset, int len, int[] docs, float[] scores, long matches, float maxScore) {
this.offset=offset;
this.len=len;
this.docs=docs;
@@ -87,7 +87,7 @@ public class DocSlice extends DocSetBase implements DocList {
@Override
public int size() { return len; }
@Override
- public int matches() { return matches; }
+ public long matches() { return matches; }
@Override
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/44d1f1fe/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 eeb6b66..245320d 100644
--- a/solr/core/src/java/org/apache/solr/search/Grouping.java
+++ b/solr/core/src/java/org/apache/solr/search/Grouping.java
@@ -605,7 +605,7 @@ public class Grouping {
}
protected DocList getDocList(GroupDocs groups) {
- int max = groups.totalHits;
+ int max = Math.toIntExact(groups.totalHits);
int off = groupOffset;
int len = docsPerGroup;
if (format == Format.simple) {
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/44d1f1fe/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 41145ba..457814c 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
@@ -101,7 +101,7 @@ public class TopGroupsResultTransformer implements ShardResultTransformer<List<C
String key = entry.getKey();
NamedList commandResult = entry.getValue();
Integer totalGroupedHitCount = (Integer) commandResult.get("totalGroupedHitCount");
- Integer totalHits = (Integer) commandResult.get("totalHits");
+ Number totalHits = (Number) commandResult.get("totalHits"); // previously Integer now Long
if (totalHits != null) {
Integer matches = (Integer) commandResult.get("matches");
Float maxScore = (Float) commandResult.get("maxScore");
@@ -114,9 +114,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, scoreDocs, maxScore);
+ topDocs = new TopDocs(totalHits.longValue(), scoreDocs, maxScore);
} else {
- topDocs = new TopFieldDocs(totalHits, scoreDocs, withinGroupSort.getSort(), maxScore);
+ topDocs = new TopFieldDocs(totalHits.longValue(), scoreDocs, withinGroupSort.getSort(), maxScore);
}
result.put(key, new QueryCommandResult(topDocs, matches));
continue;
@@ -129,7 +129,7 @@ public class TopGroupsResultTransformer implements ShardResultTransformer<List<C
String groupValue = commandResult.getName(i);
@SuppressWarnings("unchecked")
NamedList<Object> groupResult = (NamedList<Object>) commandResult.getVal(i);
- Integer totalGroupHits = (Integer) groupResult.get("totalHits");
+ Number totalGroupHits = (Number) groupResult.get("totalHits"); // // previously Integer now Long
Float maxScore = (Float) groupResult.get("maxScore");
if (maxScore == null) {
maxScore = Float.NaN;
@@ -140,7 +140,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, scoreDocs, groupValueRef, null));
+ groupDocs.add(new GroupDocs<>(Float.NaN, maxScore, totalGroupHits.longValue(), scoreDocs, groupValueRef, null));
}
@SuppressWarnings("unchecked")
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/44d1f1fe/solr/core/src/java/org/apache/solr/spelling/SpellCheckCollation.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/spelling/SpellCheckCollation.java b/solr/core/src/java/org/apache/solr/spelling/SpellCheckCollation.java
index 7f3bd95..77e3f9c 100644
--- a/solr/core/src/java/org/apache/solr/spelling/SpellCheckCollation.java
+++ b/solr/core/src/java/org/apache/solr/spelling/SpellCheckCollation.java
@@ -20,7 +20,7 @@ import org.apache.solr.common.util.NamedList;
public class SpellCheckCollation implements Comparable<SpellCheckCollation> {
private NamedList<String> misspellingsAndCorrections;
- private int hits;
+ private long hits;
private int internalRank;
private String collationQuery;
@@ -42,11 +42,11 @@ public class SpellCheckCollation implements Comparable<SpellCheckCollation> {
this.misspellingsAndCorrections = misspellingsAndCorrections;
}
- public int getHits() {
+ public long getHits() {
return hits;
}
- public void setHits(int hits) {
+ public void setHits(long hits) {
this.hits = hits;
}
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/44d1f1fe/solr/core/src/java/org/apache/solr/spelling/SpellCheckCollator.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/spelling/SpellCheckCollator.java b/solr/core/src/java/org/apache/solr/spelling/SpellCheckCollator.java
index 12369f7..cc38898 100644
--- a/solr/core/src/java/org/apache/solr/spelling/SpellCheckCollator.java
+++ b/solr/core/src/java/org/apache/solr/spelling/SpellCheckCollator.java
@@ -93,7 +93,7 @@ public class SpellCheckCollator {
PossibilityIterator.RankedSpellPossibility possibility = possibilityIter.next();
String collationQueryStr = getCollation(originalQuery, possibility.corrections);
- int hits = 0;
+ long hits = 0;
if (verifyCandidateWithQuery) {
tryNo++;
@@ -162,7 +162,7 @@ public class SpellCheckCollator {
checkResponse.setFieldFlags(f |= SolrIndexSearcher.TERMINATE_EARLY);
}
queryComponent.process(checkResponse);
- hits = (Integer) checkResponse.rsp.getToLog().get("hits");
+ hits = ((Number) checkResponse.rsp.getToLog().get("hits")).longValue();
} catch (EarlyTerminatingCollectorException etce) {
assert (docCollectionLimit > 0);
assert 0 < etce.getNumberScanned();
@@ -171,7 +171,7 @@ public class SpellCheckCollator {
if (etce.getNumberScanned() == maxDocId) {
hits = etce.getNumberCollected();
} else {
- hits = (int) ( ((float)( maxDocId * etce.getNumberCollected() ))
+ hits = (long) ( ((float)( maxDocId * etce.getNumberCollected() ))
/ (float)etce.getNumberScanned() );
}
} catch (Exception e) {
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/44d1f1fe/solr/core/src/test/org/apache/solr/search/TestRangeQuery.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/search/TestRangeQuery.java b/solr/core/src/test/org/apache/solr/search/TestRangeQuery.java
index 959386a..6591218 100644
--- a/solr/core/src/test/org/apache/solr/search/TestRangeQuery.java
+++ b/solr/core/src/test/org/apache/solr/search/TestRangeQuery.java
@@ -303,7 +303,7 @@ public class TestRangeQuery extends SolrTestCaseJ4 {
// now build some random queries (against *any* field) and validate that using it in a DBQ changes
// the index by the expected number of docs
- int numDocsLeftInIndex = numDocs;
+ long numDocsLeftInIndex = numDocs;
final int numDBQs= atLeast(10);
for (int i=0; i < numDBQs; i++) {
int lower = TestUtil.nextInt(random(), 2 * l, u);
@@ -337,7 +337,7 @@ public class TestRangeQuery extends SolrTestCaseJ4 {
assertU(commit());
try (SolrQueryRequest req = req("q","*:*","rows","0","_trace_after_dbq",dbq)) {
SolrQueryResponse qr = h.queryAndResponse(handler, req);
- final int allDocsFound = ((ResultContext)qr.getResponse()).getDocList().matches();
+ final long allDocsFound = ((ResultContext)qr.getResponse()).getDocList().matches();
assertEquals(dbq, numDocsLeftInIndex, allDocsFound);
}
}
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/44d1f1fe/solr/core/src/test/org/apache/solr/spelling/SpellCheckCollatorTest.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/spelling/SpellCheckCollatorTest.java b/solr/core/src/test/org/apache/solr/spelling/SpellCheckCollatorTest.java
index 0833e06..5428044 100644
--- a/solr/core/src/test/org/apache/solr/spelling/SpellCheckCollatorTest.java
+++ b/solr/core/src/test/org/apache/solr/spelling/SpellCheckCollatorTest.java
@@ -396,8 +396,7 @@ public class SpellCheckCollatorTest extends SolrTestCaseJ4 {
assertTrue(!usedcollations.contains(multipleCollation));
usedcollations.add(multipleCollation);
- int hits = (Integer) expandedCollation.get("hits");
- assertTrue(hits == 1);
+ assertEquals(new Long(1L), expandedCollation.get("hits"));
NamedList misspellingsAndCorrections = (NamedList) expandedCollation.get("misspellingsAndCorrections");
assertTrue(misspellingsAndCorrections.size() == 3);
@@ -473,7 +472,7 @@ public class SpellCheckCollatorTest extends SolrTestCaseJ4 {
*/
"//lst[@name='spellcheck']/bool[@name='correctlySpelled']='false'",
"//lst[@name='spellcheck']/lst[@name='collations']/lst[@name='collation']/str[@name='collationQuery']='teststop:(flew AND from AND heathrow)'",
- "//lst[@name='spellcheck']/lst[@name='collations']/lst[@name='collation']/int[@name='hits']=1",
+ "//lst[@name='spellcheck']/lst[@name='collations']/lst[@name='collation']/long[@name='hits']=1",
"//lst[@name='spellcheck']/lst[@name='collations']/lst[@name='collation']/lst[@name='misspellingsAndCorrections']/str[@name='form']='from'"
);
@@ -497,7 +496,7 @@ public class SpellCheckCollatorTest extends SolrTestCaseJ4 {
"//lst[@name='spellcheck']/lst[@name='suggestions']/lst[@name='june']/arr[@name='suggestion']/lst/str[@name='word']='jane'",
"//lst[@name='spellcheck']/bool[@name='correctlySpelled']='false'",
"//lst[@name='spellcheck']/lst[@name='collations']/lst[@name='collation']/str[@name='collationQuery']='teststop:(jane AND customs)'",
- "//lst[@name='spellcheck']/lst[@name='collations']/lst[@name='collation']/int[@name='hits']=1",
+ "//lst[@name='spellcheck']/lst[@name='collations']/lst[@name='collation']/long[@name='hits']=1",
"//lst[@name='spellcheck']/lst[@name='collations']/lst[@name='collation']/lst[@name='misspellingsAndCorrections']/str[@name='june']='jane'"
);
//SOLR-5090, alternativeTermCount==0 was being evaluated, sometimes would throw NPE
@@ -529,7 +528,7 @@ public class SpellCheckCollatorTest extends SolrTestCaseJ4 {
assertQ(req(reusedParams,
CommonParams.Q, "teststop:metnoia")
, xpathPrefix + "str[@name='collationQuery']='teststop:metanoia'"
- , xpathPrefix + "int[@name='hits']=6"
+ , xpathPrefix + "long[@name='hits']=6"
);
// specifying 0 means "exact" same as default, but specifing a value greater
@@ -540,7 +539,7 @@ public class SpellCheckCollatorTest extends SolrTestCaseJ4 {
CommonParams.Q, "teststop:metnoia",
SpellingParams.SPELLCHECK_COLLATE_MAX_COLLECT_DOCS, val)
, xpathPrefix + "str[@name='collationQuery']='teststop:metanoia'"
- , xpathPrefix + "int[@name='hits']=6"
+ , xpathPrefix + "long[@name='hits']=6"
);
}
@@ -553,7 +552,7 @@ public class SpellCheckCollatorTest extends SolrTestCaseJ4 {
CommonParams.Q, "teststop:metnoia",
SpellingParams.SPELLCHECK_COLLATE_MAX_COLLECT_DOCS, ""+val)
, xpathPrefix + "str[@name='collationQuery']='teststop:metanoia'"
- , xpathPrefix + "int[@name='hits' and . <= 17 and 0 < .]"
+ , xpathPrefix + "long[@name='hits' and . <= 17 and 0 < .]"
);
}
@@ -570,7 +569,7 @@ public class SpellCheckCollatorTest extends SolrTestCaseJ4 {
CommonParams.Q, "teststop:everother",
SpellingParams.SPELLCHECK_COLLATE_MAX_COLLECT_DOCS, ""+val)
, xpathPrefix + "str[@name='collationQuery']='teststop:everyother'"
- , xpathPrefix + "int[@name='hits' and " + min + " <= . and . <= " + max + "]"
+ , xpathPrefix + "long[@name='hits' and " + min + " <= . and . <= " + max + "]"
);
}
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/44d1f1fe/solr/solrj/src/java/org/apache/solr/client/solrj/response/SpellCheckResponse.java
----------------------------------------------------------------------
diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/response/SpellCheckResponse.java b/solr/solrj/src/java/org/apache/solr/client/solrj/response/SpellCheckResponse.java
index 89ef351..f8756cc 100644
--- a/solr/solrj/src/java/org/apache/solr/client/solrj/response/SpellCheckResponse.java
+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/response/SpellCheckResponse.java
@@ -69,7 +69,7 @@ public class SpellCheckResponse {
NamedList<Object> expandedCollation = (NamedList<Object>) o;
String collationQuery
= (String) expandedCollation.get("collationQuery");
- int hits = (Integer) expandedCollation.get("hits");
+ long hits = ((Number) expandedCollation.get("hits")).longValue();
@SuppressWarnings("unchecked")
NamedList<String> misspellingsAndCorrections
= (NamedList<String>) expandedCollation.get("misspellingsAndCorrections");