From 5a8b27b9dca7ef387e2ca79f8408a53f69d22dd3 Mon Sep 17 00:00:00 2001 From: kimchy Date: Fri, 8 Jul 2011 06:04:33 +0300 Subject: [PATCH] small optimization to counting search shards --- .../routing/operation/plain/PlainOperationRouting.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/routing/operation/plain/PlainOperationRouting.java b/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/routing/operation/plain/PlainOperationRouting.java index 654f02201e7..b152d8905ce 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/routing/operation/plain/PlainOperationRouting.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/routing/operation/plain/PlainOperationRouting.java @@ -127,9 +127,7 @@ public class PlainOperationRouting extends AbstractComponent implements Operatio int count = 0; for (String index : concreteIndices) { IndexRoutingTable indexRouting = indexRoutingTable(clusterState, index); - for (IndexShardRoutingTable indexShard : indexRouting) { - count++; - } + count += indexRouting.shards().size(); } return count; }