diff --git a/src/commands/default/building.py b/src/commands/default/building.py index 4eb34e7f7a..2da2e3fffe 100644 --- a/src/commands/default/building.py +++ b/src/commands/default/building.py @@ -1898,8 +1898,7 @@ class CmdFind(MuxCommand): nresults = results.count() if not nresults: # no matches on the keys. Try aliases instead. - results = ObjectDB.objects.filter(db_tags__db_key__iexact=searchstring, db_tags__db_category__iexact="object_alias") - #results = ObjectDB.db_aliases.filter(db_key=searchstring) + results = ObjectDB.objects.filter(db_tags__db_key__iexact=searchstring, db_tags__db_tagtype__iexact="alias") if "room" in switches: results = results.filter(db_location__isnull=True) if "exit" in switches: diff --git a/src/objects/manager.py b/src/objects/manager.py index 60e51bd9cc..9aaa474861 100644 --- a/src/objects/manager.py +++ b/src/objects/manager.py @@ -199,6 +199,7 @@ class ObjectManager(TypedObjectManager): # if candidates is an empty iterable there can be no matches # Exit early. return [] + # build query objects candidates_id = [_GA(obj, "id") for obj in make_iter(candidates) if obj] cand_restriction = candidates != None and Q(pk__in=make_iter(candidates_id)) or Q() @@ -206,7 +207,7 @@ class ObjectManager(TypedObjectManager): if exact: # exact match - do direct search return self.filter(cand_restriction & type_restriction & (Q(db_key__iexact=ostring) | - Q(db_tags__db_key__iexact=ostring) & Q(db_tags__db_category__iexact="objectalias"))).distinct() + Q(db_tags__db_key__iexact=ostring) & Q(db_tags__db_tagtype__iexact="alias"))).distinct() elif candidates: # fuzzy with candidates key_candidates = self.filter(cand_restriction & type_restriction) @@ -220,8 +221,7 @@ class ObjectManager(TypedObjectManager): if index_matches: return [obj for ind, obj in enumerate(key_candidates) if ind in index_matches] else: - alias_candidates = self.filter(id__in=candidates_id, db_tags__db_category__iexact="objectalias") - #print alias_candidates + alias_candidates = self.filter(id__in=candidates_id, db_tags__db_tagtype__iexact="alias") alias_strings = alias_candidates.values_list("db_key", flat=True) index_matches = string_partial_matching(alias_strings, ostring, ret_index=True) if index_matches: