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;
31 public function __construct($sId, $iTable = Result::TABLE_PLACEX)
33 $this->iTable = $iTable;
34 $this->iId = (int) $sId;
37 public static function joinIdsByTable($aResults, $iTable)
39 return join(',', array_keys(array_filter(
41 function ($aValue) use ($iTable) {
42 return $aValue->iTable == $iTable;
46 public static function sqlHouseNumberTable($aResults, $iTable)
50 foreach ($aResults as $oResult) {
51 if ($oResult->iTable == $iTable) {
52 $sHousenumbers .= $sSep.'('.$oResult->iId.',';
53 $sHousenumbers .= $oResult->iHouseNumber.')';
58 return $sHousenumbers;