fix notice worditerator, a=chris

Chris Pollett [2021-09-19 04:Sep:th]
fix notice worditerator, a=chris
Filename
src/library/BPlusTree.php
src/library/PartitionDocumentBundle.php
src/library/index_bundle_iterators/WordIterator.php
diff --git a/src/library/BPlusTree.php b/src/library/BPlusTree.php
index fbdc38adc..879890d72 100644
--- a/src/library/BPlusTree.php
+++ b/src/library/BPlusTree.php
@@ -77,11 +77,12 @@ class BPlusTree
      */
     const TEMP_NODE_NAME = "tmp_node";
     /**
-     *
+     * Leaf node archive file (used for blob and serial record columns) name
+     * prefix
      */
     const ARCHIVE_PREFIX = "a";
     /**
-     *
+     * Leaf node index record file name prefix
      */
     const NODE_PREFIX = "i";
     /**
@@ -145,13 +146,17 @@ class BPlusTree
      */
     public $table_tools;
     /**
-     *
+     * Cache of key-values (internal_node_path => array of subnodes) used to
+     * speed up tree traversal
+     * @var array
      */
     public $tree_path_cache = [];
     /**
      * Creates/Loads B+-Tree having specified folder and minimum_degree.
+     *
      * @param string $folder is the folder for storing the B+-Tree files
-     * @param array $format
+     * @param array $format the column names, keys and types for this
+     *  B+-Tree  object
      * @param int $max_keys
      * @param string $compressor
      */
@@ -223,7 +228,9 @@ class BPlusTree
         }
     }
     /**
-     *
+     * @param array $row
+     * @param bool $is_encoded_key
+     * @param int $mode
      */
     public function put($row, $is_encoded_key = true,
         $mode = PackedTableTools::APPEND_MODE)
@@ -267,6 +274,7 @@ class BPlusTree
     }
     /**
      *
+     * @param string $insert_node_path
      */
     public function flushLastPutNode($insert_node_path = "")
     {
@@ -281,7 +289,11 @@ class BPlusTree
         }
     }
     /**
-     *
+     * @param array $row
+     * @param array& $node
+     * @param string $archive_filename
+     * @param bool $is_encoded_key
+     * @param int $mode
      */
     public function putNode($row, &$node, $archive_filename,
         $is_encoded_key = true, $mode = PackedTableTools::APPEND_MODE)
@@ -295,6 +307,7 @@ class BPlusTree
     }
     /**
      *
+     * @param string $folder
      */
     public function updateNodePath($folder)
     {
@@ -706,7 +719,11 @@ class BPlusTree
         return [$offset, $len];
     }
     /**
+     * Returns the file path of the parent node of the current internal node
      *
+     * @param string $folder path to internal BPlusTree node folder.
+     *  (Internal nodes are folders, leaves are files)
+     * @return string file_path to parent or false, if no parent.
      */
     public function getParentFolder($folder)
     {
@@ -716,7 +733,7 @@ class BPlusTree
         return substr($folder, 0, $last_pos);
     }
     /**
-     *
+     * Save the operating parameters of this BPlusTree
      */
     public function saveParameters()
     {
@@ -725,7 +742,11 @@ class BPlusTree
             LOCK_EX);
     }
     /**
+     * Returns the parameters (such as its signature, max keys per nodes, etc)
+     * used to configure the BPlusTree stored at $folder
      *
+     * @param string $folder file path to a stored BPlusTree
+     * @return array configuration info about the BPlusTree
      */
     public static function getParameterInfo($folder)
     {
diff --git a/src/library/PartitionDocumentBundle.php b/src/library/PartitionDocumentBundle.php
index 33b6d7d05..6ada95f0b 100644
--- a/src/library/PartitionDocumentBundle.php
+++ b/src/library/PartitionDocumentBundle.php
@@ -572,7 +572,7 @@ class PartitionDocumentBundle
         $this->saveParameters();
     }
     /**
-     * Save the operataing parameters of this PartitionDocumentBundle
+     * Save the operating parameters of this PartitionDocumentBundle
      */
     public function saveParameters()
     {
diff --git a/src/library/index_bundle_iterators/WordIterator.php b/src/library/index_bundle_iterators/WordIterator.php
index 7ae376745..39c50e13a 100644
--- a/src/library/index_bundle_iterators/WordIterator.php
+++ b/src/library/index_bundle_iterators/WordIterator.php
@@ -506,7 +506,7 @@ class WordIterator extends IndexBundleIterator
             $weighted_frequency += $weight;
         }
         $frequency = 2 * $weighted_frequency *
-            $normalization_factor / $first_score;
+            $normalization_factor / max($first_score, 1);
         return $frequency;
     }
     /**
ViewGit