dont mingle name if its exact
This commit is contained in:
parent
041a272c4d
commit
5b041be8d9
2 changed files with 7 additions and 7 deletions
|
@ -60,7 +60,7 @@ def get_matches(obj, model, layer_type):
|
||||||
value = value.replace(name.lower(), '')
|
value = value.replace(name.lower(), '')
|
||||||
for name in [obj.name] + list(obj.alternativeNames):
|
for name in [obj.name] + list(obj.alternativeNames):
|
||||||
name = name.lower()
|
name = name.lower()
|
||||||
if name in value and re.compile('((^|\s)%s([\.,;:!?\-\/\s]|$))'%name).findall(value):
|
if name in value and (exact 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:
|
||||||
|
|
|
@ -14,6 +14,9 @@ def update_matching_events(id):
|
||||||
if e.annotations.exclude(id=id).count() == 0:
|
if e.annotations.exclude(id=id).count() == 0:
|
||||||
e.delete()
|
e.delete()
|
||||||
'''
|
'''
|
||||||
|
if a.get_layer().get('type') == 'event' \
|
||||||
|
and a.events.count() == 0:
|
||||||
|
a.events.add(Event.get_or_create(a.value))
|
||||||
for e in a.events.all():
|
for e in a.events.all():
|
||||||
e.update_matches()
|
e.update_matches()
|
||||||
ids = [e['id'] for e in Event.objects.all().values('id')]
|
ids = [e['id'] for e in Event.objects.all().values('id')]
|
||||||
|
@ -23,9 +26,6 @@ def update_matching_events(id):
|
||||||
if name.lower() in a.value.lower():
|
if name.lower() in a.value.lower():
|
||||||
e.update_matches()
|
e.update_matches()
|
||||||
break
|
break
|
||||||
if a.get_layer().get('type') == 'event' \
|
|
||||||
and a.events.count() == 0:
|
|
||||||
a.events.add(Event.get_or_create(a.value))
|
|
||||||
|
|
||||||
@task(ignore_resulsts=True, queue='default')
|
@task(ignore_resulsts=True, queue='default')
|
||||||
def update_matching_places(id):
|
def update_matching_places(id):
|
||||||
|
@ -36,6 +36,9 @@ def update_matching_places(id):
|
||||||
if p.annotations.exclude(id=id).count() == 0:
|
if p.annotations.exclude(id=id).count() == 0:
|
||||||
p.delete()
|
p.delete()
|
||||||
'''
|
'''
|
||||||
|
if a.get_layer().get('type') == 'place' \
|
||||||
|
and a.places.count() == 0:
|
||||||
|
a.places.add(Place.get_or_create(a.value))
|
||||||
for p in a.places.all():
|
for p in a.places.all():
|
||||||
p.update_matches()
|
p.update_matches()
|
||||||
ids = [e['id'] for e in Place.objects.all().values('id')]
|
ids = [e['id'] for e in Place.objects.all().values('id')]
|
||||||
|
@ -45,6 +48,3 @@ def update_matching_places(id):
|
||||||
if name.lower() in a.value.lower():
|
if name.lower() in a.value.lower():
|
||||||
e.update_matches()
|
e.update_matches()
|
||||||
break
|
break
|
||||||
if a.get_layer().get('type') == 'place' \
|
|
||||||
and a.places.count() == 0:
|
|
||||||
a.places.add(Place.get_or_create(a.value))
|
|
||||||
|
|
Loading…
Reference in a new issue