Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 363388

Summary: [search] Sort results by location
Product: [ECD] Orion Reporter: John Arthorne <john.arthorne>
Component: ServerAssignee: John Arthorne <john.arthorne>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: libingw
Version: 0.3   
Target Milestone: 0.4 M1   
Hardware: PC   
OS: Windows 7   
Whiteboard:

Description John Arthorne CLA 2011-11-09 16:29:19 EST
When the server returns the results one page at a time, we need to make sure all matches in the same folder arrive on the same page. The server should sort results by location.
Comment 1 John Arthorne CLA 2011-11-25 15:21:15 EST
I am going to focus on the list orientation based on our discussions this week.

The list orientation has two columns - name and location. Currently it sorts by name by default, but the user will definitely want to sort by either name or location depending on what they are doing. As a starting point I will sort by name on the server and disable the client side sorting.

In the end we are going to want to allow the user to sort by either name or location, and even toggle ascending vs. descending order. This is all quite easy to do on the server, although it means we need to re-perform the search to switch sort order. This makes sense because it is closely tied to pagination.
Comment 2 John Arthorne CLA 2011-11-28 13:57:51 EST
I have done the following:

- Added new field to the search index, "Path". This is the created using the project name, and appending the project-relative path of the content. This ends up with a string just like the "Location" column in the search results

- Changed sorting to be based on Path by default. The URL can be changed to sort by name, or to reverse the sort order. I imagine these could be wired up to URLs in the column header to switch the column used for sorting. Example:

Sort by path, ascending:
/search/search.html#?sort=Path asc&rows=40&start=0&q=foo

By path, descending:

/search/search.html#?sort=Path desc&rows=40&start=0&q=foo

By filename, either ascending or descending:

/search/search.html#?sort=Name asc&rows=40&start=0&q=foo
/search/search.html#?sort=Name desc&rows=40&start=0&q=foo
Comment 3 John Arthorne CLA 2011-11-28 14:01:20 EST
Libing, this is mostly working well, with one exception. If I sort by Name and use the List orientation, something on the client side is changing the sort order of the list. I can't find the code that is doing this. If I use the following URL, I can see the JSON list comes back from the server sorted correctly, but somehow the table ends up grouped by project, and then sorted correctly within each project. Any idea what might be doing this?
Comment 4 John Arthorne CLA 2011-11-28 14:01:40 EST
(In reply to comment #3)
> Libing, this is mostly working well, with one exception. If I sort by Name and
> use the List orientation, something on the client side is changing the sort
> order of the list. I can't find the code that is doing this. If I use the
> following URL, I can see the JSON list comes back from the server sorted
> correctly, but somehow the table ends up grouped by project, and then sorted
> correctly within each project. Any idea what might be doing this?

Forgot the URL:

http://localhost:8080/search/search.html#?sort=Name asc&rows=40&start=0&q=foo
Comment 5 libing wang CLA 2011-11-29 11:02:02 EST
(In reply to comment #4)
> (In reply to comment #3)
> > Libing, this is mostly working well, with one exception. If I sort by Name and
> > use the List orientation, something on the client side is changing the sort
> > order of the list. I can't find the code that is doing this. If I use the
> > following URL, I can see the JSON list comes back from the server sorted
> > correctly, but somehow the table ends up grouped by project, and then sorted
> > correctly within each project. Any idea what might be doing this?
> 
> Forgot the URL:
> 
> http://localhost:8080/search/search.html#?sort=Name asc&rows=40&start=0&q=foo

Flat list uses all the leaf nodes in the tree model.
So even you removed the sorter, the leaf nodes are still "grouped" by their parent chain.
I will comment this on Bug 364744 to use the original list from server.
Comment 6 libing wang CLA 2011-11-29 18:37:44 EST
John, Bug 364744  is fixed.
I think you can close this server bug.
Bug 365146 addresses client side pagination issues, but that is pure UI stuff.
Comment 7 John Arthorne CLA 2011-11-30 09:23:51 EST
Server sorting is now complete.