1818
1919import java .io .IOException ;
2020import org .apache .lucene .search .DocIdSetIterator ;
21- import org .apache .lucene .search .IndexSearcher ;
2221
2322/**
2423 * Skipper for {@link DocValues}.
@@ -128,12 +127,12 @@ public final void advance(long minValue, long maxValue) throws IOException {
128127 * Returns the minimum value for a field across all segments, or {@link Long#MIN_VALUE} if not
129128 * available
130129 *
131- * @param searcher a searcher over the index
130+ * @param reader the index reader to be queried
132131 * @param field the field to retrieve values for
133132 */
134- public static long globalMinValue (IndexSearcher searcher , String field ) throws IOException {
133+ public static long globalMinValue (IndexReader reader , String field ) throws IOException {
135134 long minValue = Long .MAX_VALUE ;
136- for (LeafReaderContext ctx : searcher . getLeafContexts ()) {
135+ for (LeafReaderContext ctx : reader . leaves ()) {
137136 if (ctx .reader ().getFieldInfos ().fieldInfo (field ) == null ) {
138137 continue ; // no field values in this segment, so we can ignore it
139138 }
@@ -152,12 +151,12 @@ public static long globalMinValue(IndexSearcher searcher, String field) throws I
152151 * Returns the maximum value for a field across all segments, or {@link Long#MIN_VALUE} if not
153152 * available
154153 *
155- * @param searcher a searcher over the index
154+ * @param reader the index reader to be queried
156155 * @param field the field to retrieve values for
157156 */
158- public static long globalMaxValue (IndexSearcher searcher , String field ) throws IOException {
157+ public static long globalMaxValue (IndexReader reader , String field ) throws IOException {
159158 long maxValue = Long .MIN_VALUE ;
160- for (LeafReaderContext ctx : searcher . getLeafContexts ()) {
159+ for (LeafReaderContext ctx : reader . leaves ()) {
161160 if (ctx .reader ().getFieldInfos ().fieldInfo (field ) == null ) {
162161 continue ; // no field values in this segment, so we can ignore it
163162 }
@@ -175,12 +174,12 @@ public static long globalMaxValue(IndexSearcher searcher, String field) throws I
175174 /**
176175 * Returns the total skipper document count for a field across all segments
177176 *
178- * @param searcher a searcher over the index
177+ * @param reader the index reader to be queried
179178 * @param field the field to retrieve values for
180179 */
181- public static int globalDocCount (IndexSearcher searcher , String field ) throws IOException {
180+ public static int globalDocCount (IndexReader reader , String field ) throws IOException {
182181 int docCount = 0 ;
183- for (LeafReaderContext ctx : searcher . getLeafContexts ()) {
182+ for (LeafReaderContext ctx : reader . leaves ()) {
184183 DocValuesSkipper skipper = ctx .reader ().getDocValuesSkipper (field );
185184 if (skipper != null ) {
186185 docCount += skipper .docCount ();
0 commit comments