]> git.openstreetmap.org Git - nominatim.git/commitdiff
prefer street results when doing house number search
authorSarah Hoffmann <lonvia@denofr.de>
Thu, 13 Mar 2014 19:34:31 +0000 (20:34 +0100)
committerSarah Hoffmann <lonvia@denofr.de>
Thu, 13 Mar 2014 19:40:02 +0000 (20:40 +0100)
This is an experimental fix for #119.

lib/Geocode.php

index f87748c3d28bae49588192ea109a64d693380cde..c6febe7384de1e128d5f12ba6140474480c58af2 100644 (file)
                                                        if ($bBoundingBoxSearch) $aTerms[] = "centroid && $sViewboxSmallSQL";
                                                        if ($sNearPointSQL) $aOrder[] = "ST_Distance($sNearPointSQL, centroid) asc";
 
-                                                       $sImportanceSQL = '(case when importance = 0 OR importance IS NULL then 0.75-(search_rank::float/40) else importance end)';
+                                                       if ($aSearch['sHouseNumber'])
+                                                       {
+                                                               $sImportanceSQL = '- abs(26 - address_rank) + 3';
+                                                       }
+                                                       else
+                                                       {
+                                                               $sImportanceSQL = '(case when importance = 0 OR importance IS NULL then 0.75-(search_rank::float/40) else importance end)';
+                                                       }
                                                        if ($sViewboxSmallSQL) $sImportanceSQL .= " * case when ST_Contains($sViewboxSmallSQL, centroid) THEN 1 ELSE 0.5 END";
                                                        if ($sViewboxLargeSQL) $sImportanceSQL .= " * case when ST_Contains($sViewboxLargeSQL, centroid) THEN 1 ELSE 0.5 END";
                                                        $aOrder[] = "$sImportanceSQL DESC";