none
People directory - alphabet filter

    Question

  • Hi,

    I have created a People directory page by adding a "People Search Core Result" web part and putting in "contentclass:spspeople" as the value in the property "Append Text to Query". This gives me the list of all the people without having to search. I have also added a "People Result refinement" web part that would display all the filters like Department, Job Title etc. 

    What i want is the Refinement web part to also have a list of Alphabets as filter, so the People can be filtered by their Name. So if i select A, all people with names starting with 'A' should be displayed. What i am wondering is can i do this by customizing the People refinement Panel web part, perhaps using the XSLT editor? Below is how it looks like right now.

    Thanks


    Friday, July 06, 2012 12:49 PM

Answers

  • Hi Sulabh,

    I've done similar by providing a content editor webpart on the page with some static HTML linking back to the same page giving an Alphabet list with each letter as a link with the relevant Keyword query in the querystring.

    <div><a href='/mypage.aspx?K=lastname:A*'>A</A></div>
    <div><a href='/mypage.aspx?K=lastname:B*'>B</A></div>
    <div><a href='/mypage.aspx?K=lastname:C*'>C</A></div>

    What this doesn't do though is retain any existing filters already established, such as department etc. if this was a requirement, I'd change the A tag into an onclick event that examines the current querystring for the K element and rebuild the query string to include other filters.

    Paul.


    Please ensure that you mark a question as Answered once you receive a satisfactory response. This helps people in future when searching and helps prevent the same questions being asked multiple times.


    • Edited by Cimares Wednesday, July 11, 2012 10:38 AM
    • Marked as answer by Sulabh Gupta Wednesday, July 11, 2012 10:41 AM
    Wednesday, July 11, 2012 10:38 AM

All replies

  • Hello,

    Thank you for your post.

    This is a quick note to let you know that we are performing research on this issue.

    Thanks,

    Monday, July 09, 2012 9:57 AM
    Moderator
  • Thanks Jack.
    Wednesday, July 11, 2012 10:20 AM
  • Hi Sulabh,

    I've done similar by providing a content editor webpart on the page with some static HTML linking back to the same page giving an Alphabet list with each letter as a link with the relevant Keyword query in the querystring.

    <div><a href='/mypage.aspx?K=lastname:A*'>A</A></div>
    <div><a href='/mypage.aspx?K=lastname:B*'>B</A></div>
    <div><a href='/mypage.aspx?K=lastname:C*'>C</A></div>

    What this doesn't do though is retain any existing filters already established, such as department etc. if this was a requirement, I'd change the A tag into an onclick event that examines the current querystring for the K element and rebuild the query string to include other filters.

    Paul.


    Please ensure that you mark a question as Answered once you receive a satisfactory response. This helps people in future when searching and helps prevent the same questions being asked multiple times.


    • Edited by Cimares Wednesday, July 11, 2012 10:38 AM
    • Marked as answer by Sulabh Gupta Wednesday, July 11, 2012 10:41 AM
    Wednesday, July 11, 2012 10:38 AM
  • Thanks a lot Paul. There is this other thing, if you have time.

    By default, we want the Employee Directory to list only the people of the current user's office location. Now, I have made a filter of Office Location in the Refinement panel and saw that this filtering too is achieved by query string. But how do i plug this in so the page shows result according to the office location? The People core results webpart is not connectable so i can rule the Filter webparts out.

    Wednesday, July 11, 2012 11:11 AM
  • Do you mean you want to only show people in the same office location, or you want the results order by Office Location?

    If you just want to show people in the current office locale, then you'll need to find a way to inject this into the query string along with whatever other filter you're using. You'll also need to find out the current users locale which probably isn't easy without resorting to some Javascript to do a quick lookup to the UPS.

    For this I'd be tempted to break out Visual Studio and look at overriding the Search Core Results webpart, That gives you the ability to inject the users location into the search query at the point where the SCRWP submits it to the service app. You can do this in the  GetXPathNavigator method.

    If you wanted to override the sorting too, this would also need to be done in a custom extension of the Search Core results by overriding the ConfigureDataSourceProperties method and setting the datasource sort order.. (example here http://blogs.msdn.com/b/jorman/archive/2010/10/06/custom-search-web-parts-in-2010.aspx)

    Hope this helps.

    Paul


    Please ensure that you mark a question as Answered once you receive a satisfactory response. This helps people in future when searching and helps prevent the same questions being asked multiple times.

    Wednesday, July 11, 2012 12:09 PM
  • Hi Paul,

    Given that the PeopleCoreResultsWebPart is sealed, what kind of effort do you think it would take to start from CoreResultWebPart and get it functioning like the out of box PeopleSCRWP? Stuff like refining by job title, sorting by social distance, I am guessing all that would have to done again? Is there some thing like this already out there so that can act as a good starting point for customizing the People search?

    Thanks,

    Sulabh

    Wednesday, July 25, 2012 11:35 AM