Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions src/cities_light/migrations/0014_alter_city_search_names.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Generated by Django 6.0.2 on 2026-02-16 17:06

import cities_light.abstract_models
from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
('cities_light', '0013_alter_city_alternate_names_alter_city_country_and_more'),
]

operations = [
migrations.AlterField(
model_name='city',
name='search_names',
field=cities_light.abstract_models.ToSearchTextField(blank=True, default='', max_length=4000, verbose_name='search names'),
),
]
16 changes: 4 additions & 12 deletions src/cities_light/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,7 @@
using several databases for your project.

Notes:
- MySQL doesn't support indexing TextFields.
- PostgreSQL supports indexing TextFields, but it is not enabled by default
- PostgreSQL and MySQL supports indexing TextFields, but it is not enabled by default
in cities_light because the lenght of the field can be too long for btree
for more information please visit #273

Expand Down Expand Up @@ -200,16 +199,9 @@
],
)

# MySQL doesn't support indexing TextFields
INDEX_SEARCH_NAMES = getattr(settings, "CITIES_LIGHT_INDEX_SEARCH_NAMES", None)
if INDEX_SEARCH_NAMES is None:
INDEX_SEARCH_NAMES = True
for database in list(settings.DATABASES.values()):
if "ENGINE" in database and (
"mysql" in database.get("ENGINE").lower()
or "postgresql" in database.get("ENGINE").lower()
):
INDEX_SEARCH_NAMES = False

INDEX_SEARCH_NAMES = getattr(settings, "CITIES_LIGHT_INDEX_SEARCH_NAMES", False)


DEFAULT_APP_NAME = "cities_light"
CITIES_LIGHT_APP_NAME = getattr(settings, "CITIES_LIGHT_APP_NAME", DEFAULT_APP_NAME)
Expand Down
Loading