modernize how Arctool computes counts of items in IndexDocumentBundle, a=chris

Chris Pollett [2022-08-12 20:Aug:th]
modernize how Arctool computes counts of items in IndexDocumentBundle, a=chris
Filename
src/executables/ArcTool.php
diff --git a/src/executables/ArcTool.php b/src/executables/ArcTool.php
index 7fd1122e4..8b48ebcda 100755
--- a/src/executables/ArcTool.php
+++ b/src/executables/ArcTool.php
@@ -531,14 +531,13 @@ class ArcTool extends DictionaryUpdater implements CrawlConstants
         }
         $count = 0;
         $visited_urls_count = 0;
-        $doc_info_position = 2 * IndexDocumentBundle::DOCID_PART_LEN;
         echo "Partition Counts\n===========\n";
         for ($i = 0; $i < $num_partitions; $i++ ) {
             $partition = $partition_bundle->loadPartitionIndex($i);
             $partition_keys = array_keys($partition);
             $docs_partition = 0;
             foreach($partition_keys as $partition_key) {
-                if ($partition_key[$doc_info_position] == 'd') {
+                if (IndexDocumentBundle::isType($partition_key, 'doc')) {
                     $docs_partition++;
                 }
             }
@@ -1289,7 +1288,7 @@ php ArcTool.php count double_index_name which_bundle
     or
 php ArcTool.php count bundle_name save
 php ArcTool.php count double_index_name which_bundle save
-    /* returns the counts of docs and links for each shard in bundle
+    /* returns the counts of docs and links for each partition in a bundle
        as well as an overall total. The second command saves the just
        computed count into the index description (can be used to
        fix the index count if it gets screwed up).
ViewGit