Make sure to avoid double multi-matches from rpsystem. Resolve #1757
This commit is contained in:
parent
c083f767d8
commit
21a5285954
2 changed files with 16 additions and 13 deletions
|
|
@ -1268,7 +1268,9 @@ class ContribRPObject(DefaultObject):
|
||||||
is_builder = self.locks.check_lockstring(self, "perm(Builder)")
|
is_builder = self.locks.check_lockstring(self, "perm(Builder)")
|
||||||
use_dbref = is_builder if use_dbref is None else use_dbref
|
use_dbref = is_builder if use_dbref is None else use_dbref
|
||||||
|
|
||||||
def search_obj(string): return ObjectDB.objects.object_search(string,
|
def search_obj(string):
|
||||||
|
"helper wrapper for searching"
|
||||||
|
return ObjectDB.objects.object_search(string,
|
||||||
attribute_name=attribute_name,
|
attribute_name=attribute_name,
|
||||||
typeclass=typeclass,
|
typeclass=typeclass,
|
||||||
candidates=candidates,
|
candidates=candidates,
|
||||||
|
|
@ -1277,7 +1279,8 @@ class ContribRPObject(DefaultObject):
|
||||||
|
|
||||||
if candidates:
|
if candidates:
|
||||||
candidates = parse_sdescs_and_recogs(self, candidates,
|
candidates = parse_sdescs_and_recogs(self, candidates,
|
||||||
_PREFIX + searchdata, search_mode=True)
|
_PREFIX + searchdata,
|
||||||
|
search_mode=True)
|
||||||
results = []
|
results = []
|
||||||
for candidate in candidates:
|
for candidate in candidates:
|
||||||
# we search by candidate keys here; this allows full error
|
# we search by candidate keys here; this allows full error
|
||||||
|
|
@ -1285,7 +1288,8 @@ class ContribRPObject(DefaultObject):
|
||||||
# in eventual error reporting later (not their keys). Doing
|
# in eventual error reporting later (not their keys). Doing
|
||||||
# it like this e.g. allows for use of the typeclass kwarg
|
# it like this e.g. allows for use of the typeclass kwarg
|
||||||
# limiter.
|
# limiter.
|
||||||
results.extend(search_obj(candidate.key))
|
results.extend([obj for obj in search_obj(candidate.key)
|
||||||
|
if obj not in results])
|
||||||
|
|
||||||
if not results and is_builder:
|
if not results and is_builder:
|
||||||
# builders get a chance to search only by key+alias
|
# builders get a chance to search only by key+alias
|
||||||
|
|
@ -1299,7 +1303,8 @@ class ContribRPObject(DefaultObject):
|
||||||
if quiet:
|
if quiet:
|
||||||
return results
|
return results
|
||||||
return _AT_SEARCH_RESULT(results, self, query=searchdata,
|
return _AT_SEARCH_RESULT(results, self, query=searchdata,
|
||||||
nofound_string=nofound_string, multimatch_string=multimatch_string)
|
nofound_string=nofound_string,
|
||||||
|
multimatch_string=multimatch_string)
|
||||||
|
|
||||||
def get_display_name(self, looker, **kwargs):
|
def get_display_name(self, looker, **kwargs):
|
||||||
"""
|
"""
|
||||||
|
|
@ -1497,5 +1502,3 @@ class ContribRPCharacter(DefaultCharacter, ContribRPObject):
|
||||||
"""
|
"""
|
||||||
return "%s|w%s|n" % ("|W(%s)" % language if language else "", text)
|
return "%s|w%s|n" % ("|W(%s)" % language if language else "", text)
|
||||||
|
|
||||||
#from evennia.contrib import rplanguage
|
|
||||||
# return "|w%s|n" % rplanguage.obfuscate_language(text, level=1.0)
|
|
||||||
|
|
|
||||||
|
|
@ -265,9 +265,9 @@ class ObjectDBManager(TypedObjectManager):
|
||||||
type_restriction = typeclasses and Q(db_typeclass_path__in=make_iter(typeclasses)) or Q()
|
type_restriction = typeclasses and Q(db_typeclass_path__in=make_iter(typeclasses)) or Q()
|
||||||
if exact:
|
if exact:
|
||||||
# exact match - do direct search
|
# exact match - do direct search
|
||||||
return self.filter(cand_restriction & type_restriction & (
|
return (self.filter(cand_restriction & type_restriction & (
|
||||||
Q(db_key__iexact=ostring) | Q(db_tags__db_key__iexact=ostring) & Q(
|
Q(db_key__iexact=ostring) | Q(db_tags__db_key__iexact=ostring) & Q(
|
||||||
db_tags__db_tagtype__iexact="alias"))).order_by('id').distinct()
|
db_tags__db_tagtype__iexact="alias")))).distinct().order_by('id')
|
||||||
elif candidates:
|
elif candidates:
|
||||||
# fuzzy with candidates
|
# fuzzy with candidates
|
||||||
search_candidates = self.filter(cand_restriction & type_restriction).distinct().order_by('id')
|
search_candidates = self.filter(cand_restriction & type_restriction).distinct().order_by('id')
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue