Building a City Search with Elixir and Python

Paul Götze
The Startup
Published in
7 min readMay 21, 2020

--

The other day I was wondering whether there was an easy self-made local alternative to something like the Google Places API, that I could use in a Phoenix app. I wanted to search for a city and wanted to get back the city itself, its state, and the country.

I found the free GeoLite2 city dataset, provided by Maxmind, which I could use to create a city search index.

In case you directly want to dive into the programmatic materialization of what I came up with, it’s available on GitHub:

I did a quick search and stumbled upon the searchex project by @andyl. This actually looked like it was exactly what I was searching for. However, there was very little documentation. So, unfortunately, I couldn’t really figure out how to get it working.

Then, while thinking about how to approach this, Whoosh, a Python package that I have used at work, came to my mind. Whoosh is a library for indexing text and searching the index. It is pretty easy to set up and delivers great search results with little effort.

--

--

Paul Götze
The Startup

Authoring code. Drawing stuff. Comics addict and fan of bad jokes. Creator of adoptoposs.org & zarenwitze.de.