Quickly custom Search Results web part in SharePoint 2010/SharePoint 2007

To create a search results web part that will dynamically create a search query and render the search results is pretty easy.

Create a new web part and inherit the CoreResultsWebPart.

public class MySearchWebPart: CoreResultsWebPart{
public MySearchWebPart(): base() {
// Initialize the search results web part here…
//e.g this.ResultsPerPage = 10; //Set the Fixed Query here.
this.FixedQuery = “Some Query”; // Build query based on some criteria. Either from Page Fields, keywords, etc.
}}







That’s it. This will give you fresh content based on the query that is built at runtime.