]> git.openstreetmap.org Git - nominatim.git/blobdiff - lib/lib.php
restrict depth of word set calculation
[nominatim.git] / lib / lib.php
index 998e0429740107343ad939e625bdf44fe3701bfe..96d2c048fcae7d2b91ca2224a9b55805dcd335e8 100644 (file)
        }
 
 
-       function getWordSets($aWords)
+       function getWordSets($aWords, $iDepth)
        {
                $aResult = array(array(join(' ',$aWords)));
                $sFirstToken = '';
-               while(sizeof($aWords) > 1)
-               {
-                       $sWord = array_shift($aWords);
-                       $sFirstToken .= ($sFirstToken?' ':'').$sWord;
-                       $aRest = getWordSets($aWords);
-                       foreach($aRest as $aSet)
+               if ($iDepth < 8) {
+                       while(sizeof($aWords) > 1)
                        {
-                               $aResult[] = array_merge(array($sFirstToken),$aSet);
+                               $sWord = array_shift($aWords);
+                               $sFirstToken .= ($sFirstToken?' ':'').$sWord;
+                               $aRest = getWordSets($aWords, $iDepth+1);
+                               foreach($aRest as $aSet)
+                               {
+                                       $aResult[] = array_merge(array($sFirstToken),$aSet);
+                               }
                        }
                }
                return $aResult;