From 46a7e891d13768c82d09c7a390ad340c6d290bad Mon Sep 17 00:00:00 2001 From: Kelketek Date: Mon, 23 Dec 2013 13:38:40 -0600 Subject: [PATCH] Fixed issue where object aliases were not being included in searches. --- src/objects/manager.py | 6 +++--- src/objects/models.py | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/objects/manager.py b/src/objects/manager.py index e98c0c9812..91e54ec812 100644 --- a/src/objects/manager.py +++ b/src/objects/manager.py @@ -197,7 +197,6 @@ 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() @@ -205,7 +204,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="object_alias"))).distinct() + Q(db_tags__db_key__iexact=ostring) & Q(db_tags__db_category__iexact="objectalias"))).distinct() elif candidates: # fuzzy with candidates key_candidates = self.filter(cand_restriction & type_restriction) @@ -219,7 +218,8 @@ 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="object_alias") + alias_candidates = self.filter(id__in=candidates_id, db_tags__db_category__iexact="objectalias") + print alias_candidates alias_strings = alias_candidates.values_list("db_key", flat=True) index_matches = string_partial_matching(alias_strings, ostring, ret_index=True) if index_matches: diff --git a/src/objects/models.py b/src/objects/models.py index e9cdfb17a2..0586d9168e 100644 --- a/src/objects/models.py +++ b/src/objects/models.py @@ -141,8 +141,8 @@ class ObjectDB(TypedObject): _GA(self, "cmdset").update(init_mode=True) _SA(self, "scripts", ScriptHandler(self)) _SA(self, "attributes", AttributeHandler(self)) - _SA(self, "tags", TagHandler(self, category_prefix="object_")) - _SA(self, "aliases", AliasHandler(self, category_prefix="object_")) + _SA(self, "tags", TagHandler(self, category_prefix="object")) + _SA(self, "aliases", AliasHandler(self, category_prefix="object")) _SA(self, "nicks", NickHandler(self)) # make sure to sync the contents cache when initializing #_GA(self, "contents_update")()