This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 209958

Summary: RepositoryQueries results unsorted
Product: projects Reporter: Jesse Glick <jglick>
Component: MavenAssignee: Milos Kleint <mkleint>
Status: RESOLVED FIXED    
Severity: normal Keywords: REGRESSION
Priority: P2    
Version: 7.2   
Hardware: PC   
OS: Linux   
Issue Type: DEFECT Exception Reporter:

Description Jesse Glick 2012-03-22 19:34:23 UTC
Until recently results from RepositoryQueries were sorted (in descending version order). For example, the "NetBeans Version" combo in maven.apisupport would always show the newest Platform version by default.

After the recent refactorings in maven.indexer this no longer seems to be true. I get RELEASE701, RELEASE691, RELEASE71, and then the rest in descending order. getVersionsResult also seems to return things out of order, with artifacts from the local repo coming first even when older than artifacts in Central.

Either need to (re-)enforce sorting in the API, or examine all callers to see if they need to manually sort themselves. The first seems preferable. For example, RQ.getVersions used to end with a call to Collections.sort. This cannot be directly reinstated due to the introduction of the Result class, but perhaps something similar can be done: for example, make its type parameter be <T extends Comparable<? super T>>, change the results field to a TreeSet<T>, and return SortedSet<T> from getResults.
Comment 1 Milos Kleint 2012-03-23 06:30:18 UTC
http://hg.netbeans.org/core-main/rev/906e70ef6b5d

sorry about leaving that out in the refactoring. However in the futue I'd like to reevaluate if sorting makes sense everywhere. getVersionsResult() or getSHAResult() is probably fine to be sorted, the result from findResult is most likely not. It should follow some sort of score ordering, however the current method we use doesn't provide that sort of information, see issue 208541
Comment 2 Quality Engineering 2012-03-24 11:06:32 UTC
Integrated into 'main-golden', will be available in build *201203240400* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/906e70ef6b5d
User: Milos Kleint <mkleint@netbeans.org>
Log: #209958 reintroduce sorting
Comment 3 Jesse Glick 2012-03-27 21:25:56 UTC
Right, for some purposes a natural sort from Lucene would be better.