SharePoint users and site owners often think of search results as a stand-alone page but it’s also a great way to aggregate content across different sites, site collections and even web applications that share the same search index without the limitations and performance issues associated with querying SharePoint lists and document libraries directly. In this blog post I’ll explain how to use the out-of-the-box Search Core Results web part to show search results on virtually any SharePoint 2010 page. We’ll use the Fixed Keyword Query property of the web part to define the search query to be executed automatically whenever a user visits the page.
First of all, we need to edit a page and add a Search Core Results web part to it:
Next, let’s edit the web part and set the Fixed Keyword Query property to the desired search query:
Then, set the Location web part property to the configure where the search results will be coming from. In this case I use FAST Search:
And that’s it, just save your changes, refresh the page and you’ll see the expected search results right on the page:
The Search Core Results web part is very flexible and exposes many different properties that allow you to customize what information is displayed and how the search results will appear on the page so I highly recommend spending some time to familiarize yourself with the customization options available out-of-the-box and require no custom web part development efforts.
In the previous blog post Extending FAST Search Processing Pipeline we created a new custom managed property called
Project and extended the FAST Search processing pipeline to populate the property with values. In this article we’ll give users the ability to refine results based on the new property values by adding a new refiner to the search results page in the search center.
First we’ll navigate to the
results.aspx page by submitting a search query.
Next we need to Edit the page and bring up the
Refinement Panel properties.
The properties we are interested in are the
Filter Category Definition and
Use Default Configuration. Go ahead and copy the
Filter Category Definition property content into your favorite text editor. Insert the following element into the original xml content. Note that the managed property name set in the
MappedProperty attribute must be in all lower case letters.
<Category Title="Project" Description="Project number" Type="Microsoft.Office.Server.Search.WebControls.ManagedPropertyFilterGenerator" MetadataThreshold="1" NumberOfFiltersToDisplay="4" MaxNumberOfFilters="20" ShowMoreLink="True" MappedProperty="project" MoreLinkText="show more" LessLinkText="show fewer" ShowCounts="Count" />
Then make sure to uncheck the
Use Default Configuration checkbox, hit Apply to submit the web part changes and Save the page. You should see similar results as in the screenshot below:
Now the users have the ability to easily refine search results by Project without having to go back and add any additional metadata to existing SharePoint content – the Project property values are generated dynamically based on the location of the document within SharePoint site hierarchy by the custom processing pipeline module implemented in the earlier blog post.