From 13fff8541552f07126402c9a717db67211284c3d Mon Sep 17 00:00:00 2001 From: Sarah Hoffmann Date: Thu, 31 Jan 2013 20:11:40 +0100 Subject: [PATCH] stack importance instead of multiplying it for order --- website/search.php | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/website/search.php b/website/search.php index 066e2c81..0f851eae 100755 --- a/website/search.php +++ b/website/search.php @@ -957,20 +957,16 @@ 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 (sizeof($aSearch['aFullNameAddress'])) - $sImportanceSQL .= '*(select count(*) from (select unnest(ARRAY['.join($aSearch['aFullNameAddress'],",").']) INTERSECT select unnest(nameaddress_vector))s)'; - 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"; + if (sizeof($aSearch['aFullNameAddress'])) + $aOrder[] = '(select count(*) from (select unnest(ARRAY['.join($aSearch['aFullNameAddress'],",").']) INTERSECT select unnest(nameaddress_vector))s) DESC'; + if (sizeof($aTerms)) { $sSQL = "select place_id"; - if (sizeof($aSearch['aFullNameAddress'])) - $sSQL .= ', (select count(*) from (select unnest(ARRAY['.join($aSearch['aFullNameAddress'],",").']) INTERSECT select unnest(nameaddress_vector))s) as fullwords'; - else - $sSQL .= ', 0'; $sSQL .= " from search_name"; $sSQL .= " where ".join(' and ',$aTerms); $sSQL .= " order by ".join(', ',$aOrder); -- 2.39.5