dont match substrings at beginging of value
This commit is contained in:
parent
c92f19f1b6
commit
eee76a5b5d
2 changed files with 2 additions and 6 deletions
|
@ -76,9 +76,7 @@ class Event(models.Model):
|
||||||
value = a.value.lower()
|
value = a.value.lower()
|
||||||
for name in [self.name] + list(self.alternativeNames):
|
for name in [self.name] + list(self.alternativeNames):
|
||||||
name = name.lower()
|
name = name.lower()
|
||||||
if name in value and (value.startswith(name) or \
|
if name in value and re.compile('((^|\s)%s([\.,;:!?\-\/\s]|$))'%name):
|
||||||
value.endswith(name) or \
|
|
||||||
re.compile('\s%s[\.,;:!?\-\/\s]'%name).findall(value)):
|
|
||||||
matches.append(a.id)
|
matches.append(a.id)
|
||||||
break
|
break
|
||||||
if not matches:
|
if not matches:
|
||||||
|
|
|
@ -86,9 +86,7 @@ class Place(models.Model):
|
||||||
value = a.value.lower()
|
value = a.value.lower()
|
||||||
for name in [self.name] + list(self.alternativeNames):
|
for name in [self.name] + list(self.alternativeNames):
|
||||||
name = name.lower()
|
name = name.lower()
|
||||||
if name in value and (value.startswith(name) or \
|
if name in value and re.compile('((^|\s)%s([\.,;:!?\-\/\s]|$))'%name):
|
||||||
value.endswith(name) or \
|
|
||||||
re.compile('\s%s[\.,;:!?\-\/\s]'%name).findall(value)):
|
|
||||||
matches.append(a.id)
|
matches.append(a.id)
|
||||||
break
|
break
|
||||||
if not matches:
|
if not matches:
|
||||||
|
|
Loading…
Reference in a new issue