nanterre: construire des index spécifiques pour les noms complets des individus (#19092)

Deux index sont construits:
* prenoms + noms_de_naissance
* prenoms + nom_d_usage
This commit is contained in:
Benjamin Dauvergne 2017-12-27 16:56:40 +01:00 committed by Thomas NOEL
parent 8684139879
commit 31f1d2b3e9
1 changed files with 11 additions and 0 deletions

View File

@ -104,3 +104,14 @@ class ZooNanterreConfig(AppConfig):
def ready(self):
post_migrate.connect(self.post_migrate)
def zoo_rebuild_indexes(self, schema):
from .utils import INDIVIDU_ENT
if schema.slug != INDIVIDU_ENT:
return
schema.create_trigram_index(
"immutable_normalize(content->>'prenoms' || ' ' || (content->>'nom_de_naissance'))")
schema.create_trigram_index(
"immutable_normalize(content->>'prenoms' || ' ' || (content->>'nom_d_usage'))")