Dataset
The dataset contains 3000+ of the biggest airports in the world.JSON
_geoloc
attribute.
Initialize the client
Configure index settings
Even if you just want to sort by distance to a location, your textual relevance should also be good so that users can refine the search with a query. To do that, you must configure the index.Searchable attributes
The searchable attributes are:name
, city
, country
, and iata_code
.
Custom ranking
Algolia will use an airport’s number of connected airports as a ranking metric. The more connections, the better.Filtering inside a polygonal area
The USA can be considered as a polygon:
insidePolygon
parameter:
- 42.01,-124.31,
- 48.835509470063045,-124.40453125000005
- 45.01082951668149,-65.95726562500005
- 31.247243545293433,-81.06578125000004
- 25.924152577235226,-97.68234374999997
- 32.300311895879545,-117.54828125
''
) returns all matching airports.