Eli Mesika has uploaded a new change for review.

Change subject: core:sorting of VMs changes during refresh
......................................................................

core:sorting of VMs changes during refresh

Adding a default secondary sort that insures that if another sort is
used all entities are sorted with entity name as a secondary field.
In case no sort is used explicitly, the entity name is used as before

Change-Id: If82b26f8b648abbce3a8337eb0ccb1212a268116
Signed-off-by: Eli Mesika <[email protected]>
---
M 
backend/manager/modules/searchbackend/src/main/java/org/ovirt/engine/core/searchbackend/SyntaxChecker.java
1 file changed, 9 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/44/11944/1

diff --git 
a/backend/manager/modules/searchbackend/src/main/java/org/ovirt/engine/core/searchbackend/SyntaxChecker.java
 
b/backend/manager/modules/searchbackend/src/main/java/org/ovirt/engine/core/searchbackend/SyntaxChecker.java
index 54472d9..bd40f2d 100644
--- 
a/backend/manager/modules/searchbackend/src/main/java/org/ovirt/engine/core/searchbackend/SyntaxChecker.java
+++ 
b/backend/manager/modules/searchbackend/src/main/java/org/ovirt/engine/core/searchbackend/SyntaxChecker.java
@@ -886,10 +886,15 @@
             String innerQuery =
                     StringFormat.format("SELECT %1$s.%2$s FROM %3$s %4$s", 
tableName, primeryKey, fromStatement,
                             wherePhrase);
+            // adding a secondary default sort by entity name
+            StringBuilder sortExpr = new StringBuilder();
+            sortExpr.append(sortByPhrase);
+            sortExpr.append(",");
+            sortExpr.append(mSearchObjectAC.getDefaultSort(searchObjStr));
+
             // only audit log search supports the SearchFrom which enables 
getting records starting from a certain
             // audit_log_id, this is done to make search queries from the 
client more efficient and eliminate the client
             // from registering to such queries and comparing last data with 
previous.
-
             String inQuery =
                     (primeryKey.equals("audit_log_id")
                             ?
@@ -902,7 +907,9 @@
                             StringFormat.format("SELECT * FROM %1$s WHERE ( 
%2$s IN (%3$s)", tableNameWithOutTags,
                                     primeryKey, innerQuery));
             retval =
-                    StringFormat.format(Config.<String> 
GetValue(ConfigValues.DBSearchTemplate), sortByPhrase, inQuery,
+                    StringFormat.format(Config.<String> 
GetValue(ConfigValues.DBSearchTemplate),
+                            sortExpr.toString(),
+                            inQuery,
                             pagePhrase);
             // Check for sql injection if query is not safe
             if (!isSafe) {


--
To view, visit http://gerrit.ovirt.org/11944
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: If82b26f8b648abbce3a8337eb0ccb1212a268116
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Eli Mesika <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to