From 25892271e83e9d510c22d5d6cdca0115677eceb1 Mon Sep 17 00:00:00 2001
From: David Smiley
Date: Thu, 13 Feb 2020 18:54:32 -0800
Subject: [PATCH] SOLR-14258: DocList should not extend DocSet
---
solr/CHANGES.txt | 2 +
.../java/org/apache/solr/search/DocList.java | 56 +------------------
.../java/org/apache/solr/search/DocSlice.java | 44 +--------------
.../org/apache/solr/search/TestDocSet.java | 6 +-
.../apache/solr/search/TestRangeQuery.java | 21 ++++---
5 files changed, 20 insertions(+), 109 deletions(-)
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index f4f55e50f51..7db27286461 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -35,6 +35,8 @@ Other Changes
* SOLR-14272: Remove autoReplicaFailoverBadNodeExpiration and autoReplicaFailoverWorkLoopDelay for 9.0 as it was
deprecated in 7.1 (Anshum Gupta)
+* SOLR-14258: DocList no longer extends DocSet. (David Smiley)
+
================== 8.5.0 ==================
Consult the LUCENE_CHANGES.txt file for additional, low level, changes in this release.
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 fee2c138b73..b136d280a93 100644
--- a/solr/core/src/java/org/apache/solr/search/DocList.java
+++ b/solr/core/src/java/org/apache/solr/search/DocList.java
@@ -25,7 +25,7 @@ package org.apache.solr.search;
*
* @since solr 0.9
*/
-public interface DocList extends DocSet {
+public interface DocList {
/**
* Returns the zero based offset of this list within the total ordered list of matches to the query.
@@ -35,7 +35,6 @@ public interface DocList extends DocSet {
/**
* Returns the number of ids in this list.
*/
- @Override
public int size();
/**
@@ -76,7 +75,6 @@ public interface DocList extends DocSet {
*
* @see #hasScores
*/
- @Override
public DocIterator iterator();
/** True if scores were retained */
@@ -87,55 +85,3 @@ public interface DocList extends DocSet {
*/
public float maxScore();
}
-
-
-/**** Maybe do this at a higher level (more efficient)
-
-class SmartDocSet implements DocSet {
- static int INITIAL_SIZE=10;
- static int TRANSITION_SIZE=10;
-
- protected BitSet bits;
- int size;
-
- protected int[] arr; // keep small set as an array, or as a hash?
- protected int arrsize;
-
- public SmartDocSet() {
- if (INITIAL_SIZE>0) {
- arr=new int[INITIAL_SIZE];
- } else {
- bits=new BitSet();
- }
- }
-
-
- public void addUnique(int doc) {
- size++;
- if (bits != null) {
- bits.set(doc);
- }
- else {
- if (arrsize<10) {
- arr[arrsize++]=doc;
- } else {
- // TODO: transition to bit set
- }
- }
- };
-
- public int size() {
- return size;
- }
- public boolean exists(int docid) {
- return false;
- }
- public DocSet intersection(DocSet other) {
- return null;
-
- }
- public DocSet union(DocSet other) {
- return null;
- }
-}
-***/
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 abd438844e4..b12ef1a916d 100644
--- a/solr/core/src/java/org/apache/solr/search/DocSlice.java
+++ b/solr/core/src/java/org/apache/solr/search/DocSlice.java
@@ -28,7 +28,7 @@ import org.apache.lucene.util.RamUsageEstimator;
*
* @since solr 0.9
*/
-public class DocSlice extends DocSetBase implements DocList {
+public class DocSlice implements DocList, Accountable {
private static final long BASE_RAM_BYTES_USED = RamUsageEstimator.shallowSizeOfInstance(DocSlice.class) + RamUsageEstimator.NUM_BYTES_ARRAY_HEADER;
final int offset; // starting position of the docs (zero based)
@@ -92,15 +92,6 @@ public class DocSlice extends DocSetBase implements DocList {
public long matches() { return matches; }
- @Override
- public boolean exists(int doc) {
- int end = offset+len;
- for (int i=offset; i