chore: add build artifacts, map assets, and routing data

This commit is contained in:
Hamza-Ayed
2026-09-19 12:34:24 +03:00
parent aa2b9f131f
commit 43ad2e0ad4
327 changed files with 52421 additions and 1810 deletions
+13 -12
View File
@@ -126,8 +126,8 @@ export class GeocodingService {
WHERE normalized_name % $1
${locationCondition}
${regionCondition}
ORDER BY (normalized_name <-> $1) ASC
LIMIT 50
ORDER BY ${hasLocation ? 'distance ASC, (normalized_name <-> $1) ASC' : '(normalized_name <-> $1) ASC'}
LIMIT 60
`;
const allResults = await Promise.race([
@@ -219,18 +219,19 @@ export class GeocodingService {
return results
.map(r => {
// Weighted scoring:
// 50% Text Match (relevance)
// 30% Popularity
// 20% Geographic Proximity
const textScore = Number(r.relevance);
const textScore = Number(r.relevance) || 0;
const popularityScore = (r.popularity_score || 10) / maxPopularity;
// Proximity bonus is 1.0 at 0m, decaying linearly to 0.0 at 10km.
const proximityBonus = hasLocation ? Math.max(0, 1 - (Number(r.distance) / 10000)) : 0;
// Proximity score: steep inverse decay so closer points get massive boost
// e.g. at 200m -> 0.91, 1km -> 0.67, 5km -> 0.28, 20km -> 0.09
const distKm = hasLocation ? (Number(r.distance) / 1000) : 0;
const proximityScore = hasLocation ? (1.0 / (1.0 + distKm * 0.5)) : 0;
const totalScore = (textScore * 0.5) + (popularityScore * 0.3) + (proximityBonus * 0.2);
// When location is available, proximity is heavily prioritized (60%)
const totalScore = hasLocation
? (proximityScore * 0.60) + (textScore * 0.30) + (popularityScore * 0.10)
: (textScore * 0.65) + (popularityScore * 0.35);
return { ...r, totalScore };
})
.sort((a, b) => b.totalScore - a.totalScore)
@@ -242,7 +243,7 @@ export class GeocodingService {
}
return true;
})
.slice(0, 4)
.slice(0, 20)
.map(r => {
const addressParts = [r.neighbourhood, r.district, r.governorate].filter(Boolean);
const full_address = addressParts.length > 0 ? addressParts.join('، ') : (r.address || '');