From 631e8d09ab8bcfedb4e211e6453c684312a0140a Mon Sep 17 00:00:00 2001 From: Brian Quinion Date: Tue, 7 Dec 2010 13:41:02 +0000 Subject: [PATCH] postcode/zipcode improvements, finish work on handling extratags --- lib/db.php | 4 +- lib/lib.php | 8 +- lib/template/details-html.php | 10 ++- nominatim/export.c | 49 ++++++++-- nominatim/import.c | 124 +++++++++++++++++++++---- nominatim/index.c | 8 ++ sql/functions.sql | 164 ++++++++++++++++++++++++++-------- sql/partitions.src.sql | 13 ++- sql/tables.sql | 17 ++++ utils/setup.php | 38 +++++++- website/details.php | 64 ++++--------- 11 files changed, 378 insertions(+), 121 deletions(-) diff --git a/lib/db.php b/lib/db.php index c50b3c40..acdb31c4 100644 --- a/lib/db.php +++ b/lib/db.php @@ -7,7 +7,9 @@ $oDB =& DB::connect(CONST_Database_DSN.($bNew?'?new_link=true':''), false); if (PEAR::IsError($oDB)) { - fail($oDB->getMessage(), 'Unable to connect to the database'); + var_dump(CONST_Database_DSN); + var_Dump($oDB); + fail($oDB->getMessage()); } $oDB->setFetchMode(DB_FETCHMODE_ASSOC); $oDB->query("SET DateStyle TO 'sql,european'"); diff --git a/lib/lib.php b/lib/lib.php index 6de3f242..acd3a5f2 100644 --- a/lib/lib.php +++ b/lib/lib.php @@ -697,12 +697,8 @@ $sSQL .= " length(name::text) as namelength "; $sSQL .= " from place_addressline join placex on (address_place_id = placex.place_id)"; $sSQL .= " where place_addressline.place_id = $iPlaceID and (rank_address > 0 OR address_place_id = $iPlaceID)"; -// and isaddress"; - if ($sCountryCode) - { - $sSQL .= " and (placex.country_code IS NULL OR placex.country_code = '".$sCountryCode."' OR rank_address < 4)"; - } - $sSQL .= " order by cached_rank_address desc,fromarea desc,distance asc,rank_search desc,namelength desc"; + $sSQL .= " order by cached_rank_address desc,isaddress desc,fromarea desc,distance asc,rank_search desc,namelength +desc"; //var_dump($sSQL); $aAddressLines = $oDB->getAll($sSQL); if (PEAR::IsError($aAddressLines)) diff --git a/lib/template/details-html.php b/lib/template/details-html.php index 0d5f6dc6..707d5726 100644 --- a/lib/template/details-html.php +++ b/lib/template/details-html.php @@ -31,8 +31,8 @@ body { float: right; } - - + +