X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/75e35f383224fb8eab3d9a28b111499c0a670eff..fd08d419629c51cb2c7b1e90814d596819d20640:/lib/SearchDescription.php diff --git a/lib/SearchDescription.php b/lib/SearchDescription.php index d18e7eab..a8285299 100644 --- a/lib/SearchDescription.php +++ b/lib/SearchDescription.php @@ -19,6 +19,27 @@ abstract class Operator const NAME = 4; /// Search for postcodes. const POSTCODE = 5; + + private $aConstantNames = null; + + public static function toString($iOperator) + { + if ($iOperator == Operator::NONE) { + return ''; + } + + if ($aConstantNames === null) { + $oReflector = new \ReflectionClass ('Nominatim\Operator'); + $aConstants = $oReflector->getConstants(); + + $aConstantNames = array(); + foreach ($aConstants as $sName => $iValue) { + $aConstantNames[$iValue] = $sName; + } + } + + return $aConstantNames[$iOperator]; + } } /** @@ -884,4 +905,33 @@ class SearchDescription return $a->iSearchRank < $b->iSearchRank ? -1 : 1; } + //////////// Debugging functions + + function dumpAsHtmlTableRow(&$aWordIDs) + { + $kf = function($k) use (&$aWordIDs) { return $aWordIDs[$k]; }; + + echo "