+
+ // secondary ordering (for results with same importance (the smaller the better):
+ // - approximate importance of address parts
+ if (isset($aResult['addressimportance']) && $aResult['addressimportance']) {
+ $aResult['foundorder'] = -$aResult['addressimportance']/10;
+ } else {
+ $aResult['foundorder'] = -$aResult['importance'];
+ }
+ // - number of exact matches from the query
+ $aResult['foundorder'] -= $aResults[$aResult['place_id']]->iExactMatches;
+ // - importance of the class/type
+ $iClassImportance = ClassTypes\getImportance($aResult);
+ if (isset($iClassImportance)) {
+ $aResult['foundorder'] += 0.0001 * $iClassImportance;
+ } else {
+ $aResult['foundorder'] += 0.01;
+ }
+ // - rank
+ $aResult['foundorder'] -= 0.00001 * (30 - $aResult['rank_search']);
+