@@ -214,13 +214,13 @@ public int hashCode() {
214
214
return Objects .hash (this .field , this .id , this .max );
215
215
}
216
216
217
- public boolean shardMatches (int shardId , int numShards ) {
217
+ public boolean shardMatches (int shardOrdinal , int numShards ) {
218
218
if (max >= numShards ) {
219
219
// Slices are distributed over shards
220
- return id % numShards == shardId ;
220
+ return id % numShards == shardOrdinal ;
221
221
}
222
222
// Shards are distributed over slices
223
- return shardId % max == id ;
223
+ return shardOrdinal % max == id ;
224
224
}
225
225
226
226
/**
@@ -234,7 +234,7 @@ public Query toFilter(ClusterService clusterService, ShardSearchRequest request,
234
234
throw new IllegalArgumentException ("field " + field + " not found" );
235
235
}
236
236
237
- int shardId = request .shardId ().id ();
237
+ int shardOrdinal = request .shardId ().id ();
238
238
int numShards = context .getIndexSettings ().getNumberOfShards ();
239
239
if ((request .preference () != null || request .indexRoutings ().length > 0 )) {
240
240
GroupShardsIterator <ShardIterator > group = buildShardIterator (clusterService , request );
@@ -250,21 +250,21 @@ public Query toFilter(ClusterService clusterService, ShardSearchRequest request,
250
250
*/
251
251
numShards = group .size ();
252
252
int ord = 0 ;
253
- shardId = -1 ;
253
+ shardOrdinal = -1 ;
254
254
// remap the original shard id with its index (position) in the sorted shard iterator.
255
255
for (ShardIterator it : group ) {
256
256
assert it .shardId ().getIndex ().equals (request .shardId ().getIndex ());
257
257
if (request .shardId ().equals (it .shardId ())) {
258
- shardId = ord ;
258
+ shardOrdinal = ord ;
259
259
break ;
260
260
}
261
261
++ord ;
262
262
}
263
- assert shardId != -1 : "shard id: " + request .shardId ().getId () + " not found in index shard routing" ;
263
+ assert shardOrdinal != -1 : "shard id: " + request .shardId ().getId () + " not found in index shard routing" ;
264
264
}
265
265
}
266
266
267
- if (shardMatches (shardId , numShards ) == false ) {
267
+ if (shardMatches (shardOrdinal , numShards ) == false ) {
268
268
// We should have already excluded this shard before routing to it.
269
269
// If we somehow land here, then we match nothing.
270
270
return new MatchNoDocsQuery ("this shard is not part of the slice" );
0 commit comments