django-cities-light icon indicating copy to clipboard operation
django-cities-light copied to clipboard

Use full text index for search_names

Open maxpoletaev opened this issue 8 years ago • 3 comments

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.

maxpoletaev avatar Apr 20 '16 13:04 maxpoletaev

Accepted, open for PR.

jpic avatar Apr 20 '16 17:04 jpic

Upcoming Django 1.10 can help: https://docs.djangoproject.com/en/dev/ref/contrib/postgres/search/

max-arnold avatar Jun 22 '16 13:06 max-arnold

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

eracle avatar Mar 06 '22 14:03 eracle