normalize find values and make lower case, also normalize and lowercase quieries

This commit is contained in:
j 2012-11-18 20:26:13 +01:00
commit ec5158c03a
7 changed files with 32 additions and 10 deletions

View file

@ -2,6 +2,7 @@
# vi:si:et:sw=4:sts=4:ts=4
from __future__ import division, with_statement
import re
import unicodedata
from django.db import models
from django.db.models import Q
@ -136,6 +137,7 @@ class Annotation(models.Model):
if self.value:
self.value = utils.cleanup_value(self.value, layer['type'])
self.findvalue = ox.decode_html(ox.strip_tags(re.sub('<br */?>\n?', ' ', self.value))).replace('\n', ' ')
self.findvalue = unicodedata.normalize('NFKD', self.findvalue).lower()
sortvalue = sort_string(self.findvalue)
if sortvalue:
self.sortvalue = sortvalue[:900]