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()
|
||||
for name in [self.name] + list(self.alternativeNames):
|
||||
name = name.lower()
|
||||
if name in value and (value.startswith(name) or \
|
||||
value.endswith(name) or \
|
||||
re.compile('\s%s[\.,;:!?\-\/\s]'%name).findall(value)):
|
||||
if name in value and re.compile('((^|\s)%s([\.,;:!?\-\/\s]|$))'%name):
|
||||
matches.append(a.id)
|
||||
break
|
||||
if not matches:
|
||||
|
|
|
@ -86,9 +86,7 @@ class Place(models.Model):
|
|||
value = a.value.lower()
|
||||
for name in [self.name] + list(self.alternativeNames):
|
||||
name = name.lower()
|
||||
if name in value and (value.startswith(name) or \
|
||||
value.endswith(name) or \
|
||||
re.compile('\s%s[\.,;:!?\-\/\s]'%name).findall(value)):
|
||||
if name in value and re.compile('((^|\s)%s([\.,;:!?\-\/\s]|$))'%name):
|
||||
matches.append(a.id)
|
||||
break
|
||||
if not matches:
|
||||
|
|
Loading…
Reference in a new issue