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

Bug 375962

Summary: File service: move search parameters out of query
Product: [ECD] Orion Reporter: Mark Macdonald <mamacdon>
Component: ClientAssignee: libing wang <libingw>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: libingw
Version: 0.5   
Target Milestone: 2.0 M2   
Hardware: PC   
OS: Windows 7   
Whiteboard:

Description Mark Macdonald CLA 2012-04-03 11:12:36 EDT
The 'search' function of the file service API looks like this:
  search: function(/**String*/ location, /**String*/ query)

The 'query' parameter encodes everything about the search: the term the user typed in, whether it's a filename or file contents search, how many 
what field to sort on, etc.

This is not ideal if you're implementing support for another file back end, since you need to interpret the query to figure out what the search options are.

It would be better if arguments were passed inside an object:
{ query: String        // search term
  isFilename: Boolean  // true to search filenames only
  itemsPerPage: Number
  startItem: Number
  sortKey: String
  sortDirection: String
  ... etc
}

This would make it the file service's job to construct whatever request is necessary to talk to the back end system. The Orion client UI would deal in named parameters, and not construct any query strings itself.
Comment 1 Mark Macdonald CLA 2012-04-03 11:13:15 EDT
(In reply to comment #0)
> The 'query' parameter encodes everything about the search: the term the user
> typed in, whether it's a filename or file contents search, how many 
> what field to sort on, etc.

Should say **how many results to show, what field to sort on, etc.**
Comment 2 Mark Macdonald CLA 2012-04-03 11:22:57 EDT
The object shape I gave in Comment 0 is just an example... We might want a more generic way of specifying that a search be restricted to certain fields only (of which "Name" would be the most obvious one).
Comment 3 libing wang CLA 2012-06-07 13:33:41 EDT
Talked to Mark. We are going to do this in 1.0 as it is not a blocker for 0.5
Comment 4 libing wang CLA 2012-10-04 16:44:35 EDT
Triage in 2.0M1.