Making WordPress.org


Ignore:
Timestamp:
10/06/2023 10:27:46 PM (9 months ago)
Author:
iandunn
Message:

Events: Only search Geonames for places with populations > 500

This ensures that searching for Genova will find the populated city with events, rather than the small village with no events.

It seems unlikely that they'll be a meetup in town with < 500, but we can revisit this if we run into that. The smallest place I saw with a meetup had a population of around 6,000.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/api.wordpress.org/public_html/events/1.0/index.php

    r12352 r12936  
    391391    global $wpdb;
    392392    // Look for a location that matches the name.
    393     // The asc ordering provides preference to the oreferred name of the locations.
     393    // The asc ordering provides preference to the preferred name of the locations.
    394394    // The population ordering provides preference to the populated areas over unpopulated/unknown.
     395    //    It's unlikely an area with less than ~500 people would hold an event, but sometimes those places rank
     396    //    higher than populated areas due to the alt vs primary name. See `Genova` unit tests
    395397    // The FIELD() orderings give preference to rows that match the country and/or timezone, without excluding rows that don't match.
    396398    // And we sort by population desc, assuming that the biggest matching location is the most likely one within the above matching groups.
     
    404406            FIELD( %s, country ) DESC,
    405407            alt ASC,
    406             population > 0 DESC,
     408            population > 500 DESC,
    407409            FIELD( %s, timezone ) DESC,
    408410            LEFT( type, 1 ) = "P" DESC,
Note: See TracChangeset for help on using the changeset viewer.