Sorting of all results - not only within pages


  • I am trying to build a company directory for our internal contacts. I am using a self feeding dataview and it basically works fine.

    I turned on sorting in xsl: <xsl: sort select="preferredname" order="ascending" />

    My problem is that this just sorts within the page. What I need is a sort of all results. How can I achieve that?

    Same for filter. It only filters within the page but not within all the results.

    Unfortunately I am only allowed to view 50 results per page - I could use that as a workaround.


    Is it possible to achieve this with webediting or SPD? If not how can I do that in VS? Any code that points in that direction, as I don't even know how to do a query against the user profiles in SSP.




    Thursday, February 14, 2008 10:06 AM

All replies

  • To clarify, are you using the simple keyword search and the people scope?

    The out of the box core results webpart?

    What is it you might sort on for example?  In most cases sorting the full result set would largely invalidate the results shown to the user.  The results are calculated based on strict ranking and confidence, and results towards the end are very bad matches.  Thats why we generally sort per page, so the user is only sorting the high confidence results.
    Tuesday, February 19, 2008 2:50 AM
  • I am trying to build a company directory. I use the core results for people search and want to sort on the last name.


    If that is not possible "out of the box" can you give me a direction on how to procede with an own web part. I wonder how to query the user profiles in the SSP.



    Tuesday, February 19, 2008 8:29 AM
  • I have this problem too.
    Monday, March 03, 2008 9:56 AM
  • This is possible out-of-the-box....

    It sounds like you just want to modify the XSL that renders the people in the core-results-web-part to include some different sortings.

    Take a look here for some help modifying the xsl:

    Or you may have luck just opening the existing xsl and modifying a few of the sort parameters.

    Sunday, March 09, 2008 4:03 AM
  • Thanks for your reply.


    I know this article and have followed it in order to create my list. The problem with this is that Sharepoint allows only a maximum of 50 list-entries per page (I have 130).

    Using XSLT I have found no way to do sorting before paging so what happens is that the results are sorted per page but not overall the list. So I get A,B,... entries on each page.


    Unfortunately MS offers sorting for the all results only per relevance and per social distance, both completely useless for my cause. I can't see why it was asked too much to offer alphabetical sorting on a given column ...


    If you know a way to do sorting with what is returned by the search engine (<xsl:variable name="Rows" select="/All_Results/Result"/>) I would be very greatful.

    So the basic question is: Is there a xslt-operation that can sort "Rows" alphabetically by a given column, write that into a new variable and then process that further.

    Thursday, March 13, 2008 8:05 AM
  • I am having the same issue and am having a terrible time finding documentation on this issue - have you been able to resolve this?


    Thursday, March 13, 2008 6:54 PM
  • I also have the same problem and want it also to clarify here:

    When using own XSLT, especially for sorting (and I also use grouping by xsl:key-functions), the problem is that only the first 50 records from the datasource (Profiles) are coming in an unsorted order. Then the xsl sort those 50 records, displays them and when user than presses Next Page, the next 50 (unordered) records are processed the same way. This leads to the fact that on the second page there are new "A*"-profiles, which should have been on the first page. In my case it's even more problematic, because same groups of first page appear on second page, just with other sub-records (I used department for grouping; so I have a header-line for each department showing me the manager and then showing the employees of this department. Department A is on first page with 10 people, and again on second page with another 5 people; but should be all 15 people on the first page.)


    One additional question in that context (which would maybe lead to a workarround):

    I there a way to query the User Profiles like querying other datalists? If so, how do I get the datalsit'S GUID?


    The former coment about relevance doesn't play a role here; there is no relevance (my XSL even supresses the rendering of "Relevance" or "Social Distance"), I just want to get the complete result-set and render that with my XSL. Maybe there is a trick to get rid of these 50-record limit?


    Best regards




    Wednesday, May 14, 2008 4:23 PM
  • Hello ,


    We are facing the same issue and unable to resolve it.


    It seems so many people are facing this issue and its really strange why MS/MVPs/MSFTs have not given any input to it. Atleast everyone is expecting from MS that whether it is possible or not???????


    Friday, May 30, 2008 10:16 AM
  • I don't know whether it is possible or not using SPD....We are waiting to hear something from MS here....


    Monday, June 02, 2008 4:45 AM

    It's not possible to sort the entire search results by modifying the xsl for the core results webpart.  You must modify the query which produced the results.  With the Out-Of-Box coreresults webpart it is only possible to sort by relevance or by date.


    It is possible to write your own search webpart.  Here are a few place to look for samples:

    Search Community Toolkit 



    Tuesday, June 03, 2008 4:58 AM
  • Hello,

    it is also possible with built-in webparts.
    I've solved the problem by using a DatFormWebPart (core results webpart's base-class) in  a webpartpage and used a XML-WebService DataSource going to /_vti_bin/search.asmx 's Query-memeber with a SELECT (wanted properties) FROM scope() where scope="People" AND DEPARTMENT LIKE "Dep A*"....

    I know this is a really short description; I'm working on an article about it being puplished on CodeProject in a week or two.

    My solution works without an own webpart, just using built-in functionallity and a lot of XSLT for sorting, grouping AND paging. So there is no need to go throught the complete gouvernance-process (we have such in place) to deploy an own webpart. I'll post a link to my articel when ready.

    Tuesday, June 03, 2008 7:46 AM
  • Hey dkurok ,


    That's reaaly a gr8 news from you !!! We will be waiting for your update and I am sure it will be easier than developing our own custom webpart for such thing.


    Thanks a lot !!!


    Wednesday, June 04, 2008 5:46 AM
  • Hello dkurok,


    Could you get any success ?????



    Thursday, June 19, 2008 7:46 AM
  • Hello Baly,


    I have the first part of the article online.


    The article 'MOSS 2007 Department and People Viewer Part 1/2' by Dietmar Kurok is now available at:


    Hope it helps to get started. I'll try to get the rest faster!

    Tuesday, June 24, 2008 2:28 PM