From d69f8034f9cd77be247f3c39be9416bfabbc9a75 Mon Sep 17 00:00:00 2001 From: Mariano ramirez Date: Mon, 16 Feb 2026 12:51:29 -0400 Subject: [PATCH 1/2] Update README and settings.py to address common issues and improve localization support - Added a section in README for common issues related to index row size in PostgreSQL, including solutions for disabling indexing and limiting translation languages. --- README.rst | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/README.rst b/README.rst index a1b5d435..056cd7b6 100644 --- a/README.rst +++ b/README.rst @@ -110,6 +110,25 @@ Consult the help with:: ./manage.py help cities_light_fixtures + +Common issues +-------------- + +If you get the following error:: + + django.db.utils.OperationalError: index row size 2848 exceeds btree version 4 maximum 2704 for index "cities_light_city_search_names_fb77fed2" + DETAIL: Index row references tuple (1314,1) in relation "cities_light_city". + 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. + +You can fix it by adding the following to your settings.py, this will disable the indexing of the search_names field:: + + CITIES_LIGHT_INDEX_SEARCH_NAMES = False + +Another option is limiting the languages for example to only English and abbreviation, this will fix the issue:: + + CITIES_LIGHT_TRANSLATION_LANGUAGES = [ 'en', 'abbr'] + Development ----------- @@ -166,13 +185,6 @@ To run it even faster, you can switch to specific tox virtualenv:: CI=true test_project/manage.py test cities_light.tests.test_form.FormTestCase.testCountryFormNameAndContinentAlone -If you want to generate the translations, use the following steps:: - - source .tox/dev/bin/activate - cd src/cities_light - python manage.py makemessages -l fr - python manage.py compilemessages - If you want to build the docs, use the following steps:: source .tox/dev/bin/activate From b7c587b7383e802bd6075aa00c3878c243658f58 Mon Sep 17 00:00:00 2001 From: Mariano ramirez Date: Mon, 16 Feb 2026 13:00:07 -0400 Subject: [PATCH 2/2] Enhance README with additional guidance on managing city and country imports - Added new sections to the README detailing how to limit imported countries and cities in settings.py. - Included instructions for excluding specific city and region types to optimize data imports. - Expanded the common issues section to address index size errors and provide relevant solutions. --- README.rst | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/README.rst b/README.rst index 056cd7b6..0a31b281 100644 --- a/README.rst +++ b/README.rst @@ -114,6 +114,9 @@ Consult the help with:: Common issues -------------- +Search names index size issue +------------------------------ + If you get the following error:: django.db.utils.OperationalError: index row size 2848 exceeds btree version 4 maximum 2704 for index "cities_light_city_search_names_fb77fed2" @@ -129,6 +132,27 @@ Another option is limiting the languages for example to only English and abbrevi CITIES_LIGHT_TRANSLATION_LANGUAGES = [ 'en', 'abbr'] +You want to import only the countries you need, for example France, Belgium and Netherlands, you can do it by adding the following to your settings.py:: + + CITIES_LIGHT_INCLUDE_COUNTRIES = ['FR', 'BE', 'NL'] + +You want to import only the cities you need, for example Paris, Brussels and Amsterdam, you can do it by adding the following to your settings.py:: + + CITIES_LIGHT_INCLUDE_CITY_TYPES = ['PPL', 'PPLA', 'PPLA2', 'PPLA3', 'PPLA4', 'PPLC', 'PPLF', 'PPLG', 'PPLL', 'PPLR', 'PPLS', 'STLMT',] + +You don't want to import the cities and regions and subregions, you can do it by adding the following to your settings.py:: + + CITIES_LIGHT_INCLUDE_CITY_TYPES = [] + CITIES_LIGHT_INCLUDE_REGION_TYPES = [] + CITIES_LIGHT_INCLUDE_SUBREGION_TYPES = [] + +Or you can set the sources to empty list: + + CITIES_LIGHT_REGION_SOURCES = [] + CITIES_LIGHT_SUBREGION_SOURCES = [] + CITIES_LIGHT_CITY_SOURCES = [] + + Development -----------