]> git.openstreetmap.org Git - nominatim.git/commitdiff
consider possibility that values with number in near start of search might be a house...
authorBrian Quinion <openstreetmap@brian.quinion.co.uk>
Tue, 5 Apr 2011 14:51:32 +0000 (14:51 +0000)
committerBrian Quinion <openstreetmap@brian.quinion.co.uk>
Tue, 5 Apr 2011 14:51:32 +0000 (14:51 +0000)
lib/lib.php
lib/template/search-html.php
website/search.php

index 1a320a18af3a859dbe53191c38de9fa38cc71e83..7f56a1de68f5f339eec7064b3397cb9350c2f501 100644 (file)
  'amenity:shopping' => array('label'=>'Shopping','frequency'=>21,'icon'=>'',),
  'natural:scrub' => array('label'=>'Scrub','frequency'=>20,'icon'=>'',),
  'natural:fen' => array('label'=>'Fen','frequency'=>20,'icon'=>'',),
+ 'building:yes' => array('label'=>'Building','frequency'=>200,'icon'=>'',),
 
  'amenity:parking' => array('label'=>'Parking','frequency'=>3157,'icon'=>'',),
  'highway:bus_stop' => array('label'=>'Bus Stop','frequency'=>35777,'icon'=>'transport_bus_stop2',),
index 986b4e4d6a02c9ab4d9150dddc7c96c492b4ef7b..f701379329a41d17065ebe59b47525c916283997 100644 (file)
@@ -372,7 +372,10 @@ target="_blank">FAQ</a></td>
                echo ' <span class="name">'.$aResult['name'].'</span>';
                echo ' <span class="latlon">'.round($aResult['lat'],3).','.round($aResult['lat'],3).'</span>';
                echo ' <span class="place_id">'.$aResult['place_id'].'</span>';
-               echo ' <span class="type">('.ucwords(str_replace('_',' ',$aResult['type'])).')</span>';
+               if (isset($aResult['label']))
+                       echo ' <span class="type">('.$aResult['label'].')</span>';
+               else
+                       echo ' <span class="type">('.ucwords(str_replace('_',' ',$aResult['type'])).')</span>';
                echo ' <span class="details">(<a href="details.php?place_id='.$aResult['place_id'].'">details</a>)</span>';
                echo '</div>';
        }
index 6a997acbfa7ddda08f8b4bdc303db1c486e1e744..070ca5245a05ec50da87bc4984020d7d5f9575b9 100755 (executable)
                                {
                                        unset($aPhrases[$iPhrase]);
                                }
-                       }                       
+                       }
 
                        // reindex phrases - we make assumptions later on
                        $aPhrases = array_values($aPhrases);
                                }
                        }
 */
+
+                       foreach($aTokens as $sToken)
+                       {
+                               // Unknown single word token with a number - assume it is a house number
+                               if (!isset($aValidTokens[' '.$sToken]) && strpos($sToken,' ') === false && preg_match('/[0-9]/', $sToken))
+                               {
+                                       $aValidTokens[' '.$sToken] = array('class'=>'place','type'=>'house');
+                               }
+                       }
+
                        // Any words that have failed completely?
                        // TODO: suggestions
 
                        $aResult['icon'] = CONST_Website_BaseURL.'images/mapicons/'.$aClassType[$aResult['class'].':'.$aResult['type']]['icon'].'.p.20.png';
                }
 
+               if (isset($aClassType[$aResult['class'].':'.$aResult['type']]['label']) 
+                       && $aClassType[$aResult['class'].':'.$aResult['type']]['label'])
+               {
+                       $aResult['label'] = $aClassType[$aResult['class'].':'.$aResult['type']]['label'];
+               }
+
                if ($bShowAddressDetails)
                {
                        $aResult['address'] = getAddressDetails($oDB, $sLanguagePrefArraySQL, $aResult['place_id'], $aResult['country_code']);