WordPress.org

Making WordPress.org

Opened 18 months ago

#3367 new defect

Events API: Improve city disambiguation

Reported by: iandunn Owned by:
Milestone: Priority: normal
Component: API Keywords: needs-patch needs-unit-tests
Cc:

Description

Moved from #wp42787, reported by @shedonist:

The Events & News widget in the admin dashboard only accepts a city name and ignores when you add a state. This means it picks a state for you and it may not be the state you want. This makes it extremely difficult to locate meetups in cities where different cities with the same name both have meetups.

For example, I run a meetup in Portsmouth, NH. When I search for "Portsmouth, NH" or "Portsmouth" the widget is showing results near Portsmouth, VA. When I search for "Boston", the Portsmouth, NH does show (so it is in there!). Similarly, if you search for "Portland, OR" or "Portland" you only see the meetups near Portland, ME (Portsmouth, NH and Westbrook, ME).

When I search for "Portsmouth, NH", I get this:
[06-Dec-2017 23:00:12 UTC] debug_community_events_response: Valid response received. Details: {"request_url":"https:\/\/api.wordpress.org\/events\/1.0\/","request_args":{"number":5,"ip":"127.0.0.0","locale":"en_US","timezone":"America\/New_York","location":"Portsmouth, NH"},"response_code":200,"response_body":{"location":{"description":"Portsmouth","latitude":"36.8354300","longitude":"-76.2982700","country":"US"},"events":"4 events trimmed."}}

If I search for "Portsmouth", what I get seems to be identical except for the location field:
[06-Dec-2017 23:00:25 UTC] debug_community_events_response: Valid response received. Details: {"request_url":"https:\/\/api.wordpress.org\/events\/1.0\/","request_args":{"number":5,"ip":"127.0.0.0","locale":"en_US","timezone":"America\/New_York","location":"Portsmouth"},"response_code":200,"response_body":{"location":{"description":"Portsmouth","latitude":"36.8354300","longitude":"-76.2982700","country":"US"},"events":"4 events trimmed."}}

If I search for "Portland, OR", I get this:
[06-Dec-2017 23:01:35 UTC] debug_community_events_response: Valid response received. Details: {"request_url":"https:\/\/api.wordpress.org\/events\/1.0\/","request_args":{"number":5,"ip":"127.0.0.0","locale":"en_US","timezone":"America\/New_York","location":"Portland, OR"},"response_code":200,"response_body":{"location":{"description":"Portland","latitude":"43.6614700","longitude":"-70.2553300","country":"US"},"events":"5 events trimmed."}}

This is related to #2823, it may be one of the things that's just too complex to accomplish in a homegrown API, and we should instead just focus on the move to Google's. But it's worth some investigating first to find out.

This will need lots of unit tests to cover different variations in formats, etc.

Change History (0)

Note: See TracTickets for help on using tickets.