[ 
https://issues.apache.org/jira/browse/RANGER-3500?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17434853#comment-17434853
 ] 

Xuze Yang commented on RANGER-3500:
-----------------------------------

In addition, in the method of sorting the policy list, only the sortBy field is 
used, and the sortType field is not used. so all sorts are 'asc'. We need to 
modify the sorting method to support 'desc' too. So The code can be modified as 
follows:
1. When deep copying SearchFilter, add a copy of sortBy and sortType fields
2. Modify the sorting method to support 'desc'

> Ranger policy list doesn't support sorting by field
> ---------------------------------------------------
>
>                 Key: RANGER-3500
>                 URL: https://issues.apache.org/jira/browse/RANGER-3500
>             Project: Ranger
>          Issue Type: Bug
>          Components: admin
>    Affects Versions: 2.1.0
>            Reporter: Xuze Yang
>            Priority: Major
>
> When getting the ranger policy list, we may want to sort the returned policy 
> list according to certain fields, such as policyId, policyName and etc. But 
> case shows that adding the parameters sortBy and sortType to the url has no 
> effect (eg: 
> [http://192.168.0.12:6080/service/plugins/]policies/service/2?sortBy=policyName&sortType=desc&serviceName=default-Hdfs).
>  I look through the source code and find that code supports sorting by 
> fields, but due to some code bugs, it did not really take effect. 
>  The main reason for the problem is that when the SearchFilter is copied 
> deeply, only the params is copied, the sortBy and sortType attributes is 
> omitted. The code show as follows:
> {code:java}
> Map<String, String> paramsCopy  = new HashMap<>(filter.getParams());
> SearchFilter       searchFilter = new SearchFilter(paramsCopy);
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to