allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jetm...@apache.org
Subject [32/42] git commit: [#7278] ticket:638 Fix bug in translate_query
Date Mon, 25 Aug 2014 11:33:52 GMT
[#7278] ticket:638 Fix bug in translate_query


Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/00dffc3f
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/00dffc3f
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/00dffc3f

Branch: refs/heads/je/42cc_7585
Commit: 00dffc3f85e511e5ffe006b85b3d4e5d09ce9a88
Parents: 5680be0
Author: Igor Bondarenko <jetmind2@gmail.com>
Authored: Tue Aug 19 13:34:49 2014 +0000
Committer: Dave Brondsema <dbrondsema@slashdotmedia.com>
Committed: Thu Aug 21 18:49:57 2014 +0000

----------------------------------------------------------------------
 Allura/allura/model/artifact.py | 5 +++++
 1 file changed, 5 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/00dffc3f/Allura/allura/model/artifact.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/artifact.py b/Allura/allura/model/artifact.py
index 81d9e7a..2639021 100644
--- a/Allura/allura/model/artifact.py
+++ b/Allura/allura/model/artifact.py
@@ -137,6 +137,11 @@ class Artifact(MappedClass, SearchIndexable):
         ``fields``.
 
         """
+        # Replace longest fields first to avoid problems when field names have
+        # the same suffixes, but different field types. E.g.:
+        # query 'shortname:test' with fields.keys() == ['name_t', 'shortname_s']
+        # will be translated to 'shortname_t:test', which makes no sense
+        fields = sorted(fields.keys(), key=len, reverse=True)
         for f in fields:
             if '_' in f:
                 base, typ = f.rsplit('_', 1)


Mime
View raw message