다음을 통해 공유


Using Custom Properties to create a FAST Search for SharePoint 2010 User Context

A User Context is a cool thing in FAST Search for SharePoint that allows you to target search results based on contextual information about a person. It could be what department they're in, what group they work for, etc. You can create different user contexts and associate them with best bets. That allows you, for example, to have two different people see two different best bets when they search for "sales report". Depending on their user context, you can promote financial information to someone in accounting, and a marketing plan to someone in marketing. To really customize your user context, you may want to use different or additional user profile fields from what comes out of the box. Hopefully, this blog will help you understand how to do that.

 

The first thing to know is which FAST Service Application you need to work with – the FAST Search Connector (i.e. index) where all the content sources are, or the FAST Search Query. You want to actually use the FAST Search Query service application.

 

The next thing you need to know is what properties is it currently using? The answer is to open the SharePoint PowerShell admin console and use the following command:

 

Get-SPEnterpriseSearchExtendedQueryProperty -SearchApplication "Your FAST index Search App Name" -Identity "FASTSearchContextProperties"

 

If you have multiple properties, then by default we’ll display the results in a column with an ellipsis at the end and you may not be able to see all of the actual values. To work around that, use a simple 2 line PowerShell like this:

 

$props = Get-SPEnterpriseSearchExtendedQueryProperty -SearchApplication "Your FAST index Search App Name" -Identity "FASTSearchContextProperties"

$props.Value

 

Once you’ve figured out which properties you want to use in your user context, you use another very similar command to plug in the values. For example, this is how to configure it to use location, skills and department:

 

Set-SPEnterpriseSearchExtendedQueryProperty -SearchApplication "Your FAST index Search App Name" -Identity "FASTSearchContextProperties" -Value "SPS-Location,SPS-Skills,Department"

 

What’s really slick too about the properties, is that if you include one whose values are stored in a managed metadata service app, when you create a new user context a picker button appears next to the field. If you click it, it opens up a dialog where you can pick from all of the values that have been entered for that field. Very cool!

 

Finally, if you want to get a list of all of the user profile property names (like SPS-Location, SPS-Skills, etc.) you need to use the UserProfileManagerConfig class, and call the GetCoreProperties method. I've created a simple application that does that called the My ProfileManagerPropertyNames; it is an attachment to this posting.

ProfileManagerPropertyNames.zip

Comments

  • Anonymous
    January 01, 2003
    The comment has been removed

  • Anonymous
    January 01, 2003
    Hi, was able to set this, but the new properties don't appear on the admin interface and adding contexts using these added properties, such as department, didn't work for us. Running this: PS C:FAST ContentCeonex ContentScripts> $props = Get-SPEnterpriseSearchExtendedQueryProperty -SearchApplication "FASTContent" -Identity "FASTSearchContextProperties" $props.Value Gives this: SPS-Location,SPS-Skills,SPS-Responsibility,Department But adding a context using department doesn't appear to give any matches when we test using a search that has a context sensitive result. Is there something else required? (Setting up the same context using SPF-Responsibility works)

  • Anonymous
    June 20, 2011
    The comment has been removed

  • Anonymous
    September 18, 2014
    The comment has been removed

  • Anonymous
    February 28, 2015
    I've been working on a developer tool off and on for months now to help working with the query engine