← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 21024: translation optimization for QueryParser

 

------------------------------------------------------------
revno: 21024
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2015-11-11 13:19:50 +0700
message:
  translation optimization for QueryParser
modified:
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/query/DefaultQueryParser.java


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/query/DefaultQueryParser.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/query/DefaultQueryParser.java	2015-11-06 08:31:07 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/query/DefaultQueryParser.java	2015-11-11 06:19:50 +0000
@@ -76,6 +76,23 @@
 
     private Restriction getRestriction( Schema schema, String path, String operator, Object arg ) throws QueryParserException
     {
+        // optimize if not translated
+        if ( !schema.isTranslated() )
+        {
+            if ( path.startsWith( "displayName:" ) && schema.havePersistedProperty( "name" ) )
+            {
+                path = path.replace( "displayName:", "name:" );
+            }
+            else if ( path.startsWith( "displayShortName:" ) && schema.havePersistedProperty( "shortName" ) )
+            {
+                path = path.replace( "displayShortName:", "shortName:" );
+            }
+            else if ( path.startsWith( "displayDescription:" ) && schema.havePersistedProperty( "description" ) )
+            {
+                path = path.replace( "displayDescription:", "description:" );
+            }
+        }
+
         Property property = getProperty( schema, path );
 
         if ( property == null )