django-cities-light
django-cities-light copied to clipboard
Use full text index for search_names
Using db_index
for search_names
is bad way. You should create full text index, not btree.
Currently when importing geo data with many languages I get the error:
django.db.utils.OperationalError: index row size 4016 exceeds maximum 2712 for index "geo_city_610a2ab0"
HINT: Values larger than 1/3 of a buffer page cannot be indexed.
Consider a function index of an MD5 hash of the value, or use full text indexing.
Accepted, open for PR.
Upcoming Django 1.10 can help: https://docs.djangoproject.com/en/dev/ref/contrib/postgres/search/
Django 3.1.13; postgis 13; django-cities-light 3.9.0.
Solved by putting this in Django settings:
CITIES_LIGHT_INDEX_SEARCH_NAMES = False