>Getting all people to show in a Fixed Keyword Query

>Recently I have been playing around with the out of the box search web parts. As always its not really until you have a need do you start thinking about how you could do something.

Well one of my clients wished to get a list of all the people and display which languages they spoke. When I get around to it I will go over extending the User Profiles in more detail, to be fair there are plenty of examples on the web.

To help you understand what I am doing, create a new page and add a People Search Core Results web part. Modify the web part settings and click on Fixed Keyword Query.
This is where we can get the web part to display the results automatically.

You fill in a query such as: Bob click Apply and if any of your users have the word Bob in their profile they will show.

You also need to change the Cross-Web Part query ID to a non User Query, I use Query 2.

Anyway one of the things with a fixed keyword query is that you cannot submit a wildcard query. For example: FirstName:*

If you try this then you will get a message saying that the only search terms were wildcard or something like that.

Ok so how do we get all the people to show?
However you can do the following you can query to show using the content class property.
Therefore put in the following query: contentclass:urn:content-class:SPSPeople
Click Apply and low and behold all the users popup.

Then I had to manupulate the properties that were selected and also update the XSLT.. bobs your uncle it works.

But how did you find out the Content Class?
Well I wrote a little web part which pulled out the ContentClass property.
You could extend the Selected Columns and then manupulate the XSLT. I will update this post at a later date and talk about this.

In the meantime try it out.

2 Comments

  1. Save The Day! I built a custom web part for sorted by last name search results using the CoreResultsWebPart. But I was getting non people, but looked like people, records returned. I could not figure out how to tell the CoreResultsWebPart to only return people results, like when you put s=People on the query string for search results. It was not until I saw you use “contentclass:urn:content-class:SPSPeople”. So I put it in as a SupplementalQuery string on the CoreResultsDatasource and it worked. Thanks.

    Reply

Thoughts? Comments about this post? Please leave them here..

This site uses Akismet to reduce spam. Learn how your comment data is processed.