Pearl1594 commented on code in PR #9547:
URL: https://github.com/apache/cloudstack/pull/9547#discussion_r1755742062


##########
server/src/main/java/com/cloud/api/query/QueryManagerImpl.java:
##########
@@ -1447,13 +1447,18 @@ private Pair<List<Long>, Integer> 
searchForUserVMIdsAndCount(ListVMsCmd cmd) {
         }
 
         if (keyword != null) {
-            userVmSearchBuilder.and().op("keywordDisplayName", 
userVmSearchBuilder.entity().getDisplayName(), Op.LIKE);
-            userVmSearchBuilder.or("keywordName", 
userVmSearchBuilder.entity().getHostName(), Op.LIKE);
-            userVmSearchBuilder.or("keywordState", 
userVmSearchBuilder.entity().getState(), Op.EQ);
+            SearchBuilder<UserVmJoinVO> userVmJoinSearchBuilder = 
_userVmJoinDao.createSearchBuilder();

Review Comment:
   this would involve 3 different tables. Do you think it would still be 
beneficial? I tried something along these lines:
   ```
   SearchBuilder<NicVO> nicsSearch = nicDao.createSearchBuilder();
   nicsSearch.or("keywordIpAddress", nicsSearch.entity().getIPv4Address(), 
Op.LIKE);
   nicsSearch.or("keywordIp6Address", nicsSearch.entity().getIPv6Address(), 
Op.LIKE);
   userVmSearchBuilder.join("nicIpKeyword", nicsSearch, 
nicsSearch.entity().getInstanceId(), userVmSearchBuilder.entity().getId(), 
JoinBuilder.JoinType.INNER);
   
   SearchBuilder<IPAddressVO> publicIPAddressSearch = 
ipAddressDao.createSearchBuilder();
   publicIPAddressSearch.or("keywordPublicIpAddress", 
publicIPAddressSearch.entity().getAddress(), Op.LIKE);
   userVmSearchBuilder.join("userIpKeyword", publicIPAddressSearch, 
publicIPAddressSearch.entity().getAssociatedWithVmId(), 
userVmSearchBuilder.entity().getId(), JoinBuilder.JoinType.INNER);
   ```
   
   But this doesn't seem to work as expected, as each  inner join does an AND 
op with the keyword. Any pointers on what could be missing?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to