6  * A single result of a search operation or a reverse lookup.
 
   8  * This object only contains the id of the result. It does not yet
 
   9  * have any details needed to format the output document.
 
  13     const TABLE_PLACEX = 0;
 
  14     const TABLE_POSTCODE = 1;
 
  15     const TABLE_OSMLINE = 2;
 
  17     const TABLE_TIGER = 4;
 
  19     /// Database table that contains the result.
 
  23     /// House number (only for interpolation results).
 
  24     public $iHouseNumber = -1;
 
  25     /// Number of exact matches in address (address searches only).
 
  26     public $iExactMatches = 0;
 
  27     /// Subranking within the results (the higher the worse).
 
  28     public $iResultRank = 0;
 
  30     public function debugInfo()
 
  33                 'Table' => $this->iTable,
 
  35                 'House number' => $this->iHouseNumber,
 
  36                 'Exact Matches' => $this->iExactMatches,
 
  37                 'Result rank' => $this->iResultRank
 
  42     public function __construct($sId, $iTable = Result::TABLE_PLACEX)
 
  44         $this->iTable = $iTable;
 
  45         $this->iId = (int) $sId;
 
  48     public static function joinIdsByTable($aResults, $iTable)
 
  50         return join(',', array_keys(array_filter(
 
  52             function ($aValue) use ($iTable) {
 
  53                 return $aValue->iTable == $iTable;
 
  57     public static function sqlHouseNumberTable($aResults, $iTable)
 
  61         foreach ($aResults as $oResult) {
 
  62             if ($oResult->iTable == $iTable) {
 
  63                 $sHousenumbers .= $sSep.'('.$oResult->iId.',';
 
  64                 $sHousenumbers .= $oResult->iHouseNumber.')';
 
  69         return $sHousenumbers;