Announcing custom sort order support for WildcardSearchWebPart
Posted
Wednesday, May 20, 2009 8:56 AM
by
CoreyRoth
I was reading the forums the other day and saw another post in the MOSS Search forum about someone wanting to be able to specify a custom sort order with the CoreResultsWebPart. WildcardSearchWebPart will allow you to specify a static full text sql query or it builds one of its own. The problem is, the CoreResultsWebPart that it inherits from has logic in it to go and add an ORDER BY clause based on data modified or relevance. This causes an issue because if you specify your own order by clause, it causes a syntax error. This post had a rather simple solution to solving the issue. The answer is to simply add your own ORDER BY clause followed by a -- (SQL comment). This causes the syntax to be valid and everything works.
After seeing this, I immediately knew I wanted to add this to the WildcardSearchWebPart. I added a new property called SortOrder which would allow you pass any valid ORDER BY clause. For example:
- Title
- Author DESC
- ContentSource, Author DESC, Title
You should be able to sort on any manager property that you have returned in the Select Columns XML field. Give it a try and see how it works. My next step to research is to see if I can implement this with a keyword query. Try it out and post any issues you run into on CodePlex.
Wildcard Search Version 1.0 Release 4
Follow me on twitter.