Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I would like to create a custom search page that allows users to search values specific to a content type. Coming from an ASP.NET background my first impulse was to create a web part that:

  • Allowed users to enter search criteria
  • Performed the search
  • Displayed the results

I did some investigation and found the "Search Core Results" web part in SharePoint 2010. With this it appears that you can just values in your query string and it will handle both the searching and displaying of data.

My question is what would be the best approach to create my custom search page?

Should I create a custom webpart that will allow users to enter their search criteria and then craft a query string that will allow the Search Core Results web part to display the data?

Is there a "no code" solution that I should be using?

Should I just do what I had originally planned and custom code everything?

share|improve this question

3 Answers 3

If you just want to search item of specific content type and customize search results, you do not need to write any custom code. IN fact, you can apply many more search customizations techniques without writing code.

Following is high level directions assuming you are using Search Center to perform the search:

  1. (In CA) Make sure ContentType Managed Property is checked

enter image description here

  1. Create a custom search scope (Shared in CA or at Site Collection level) and add rule to define the scope. At minimum, you need Rule like: ContentType=Task (example)

  2. Perform full content crawl and make sure your scope appears as "Ready" and there are number items displayed.

  3. Also make sure its part of "Search DropDown" group as shown below:

enter image description here

  1. Edit the search center page's search box web part so that it displays the scope dropdown.

  2. Select your search keyword and scope and it should dislay the search results in that scope.

share|improve this answer
    
I want to be able to search each column of the content type for specific values. For example if I have a Choice column I would like the user to be able to select from a dropdownlist when specifying their criteria. Can this be done using your method? –  Abe Miessler Jul 8 '11 at 15:40
    
You can create a managed property which corresponds to your column and then make it available in Property Selector in "Adcanced Search" page. But do not expect SharePoint to render a dropdown for choice field. You will have to write your own custom code for that. –  Ashish Patel Jul 8 '11 at 15:45

Another viable option is to do the following:

  • Follow steps to create the scope from ashish patel (http://sharepoint.stackexchange.com/questions/15806/creating-a-custom-serach-page/15810#15810)
  • Copy your OOTB search page and alter the properties of your webpart to only use the scope you created.
  • When that search page is used, only results within that scope are displayed.
  • Now you can modify your results page (specific for this result-set!)
  • You can use the faceted search (refinement panel) to drill down your selection. To add items to this webpart, you need to add managed metadata properties in the search admin page. There is a lot of information on this subject.

This solution is fully an out of the box solution, no code required. Difference with question: you wanted to a interface to select the query options before the query has been run. This option lets you narrow down the results after the query has been run. Example implementation: https://www.werkenbijachmea.nl/Vacatures/Paginas/default.aspx (is in dutch, but I hope that you understand the concept)

share|improve this answer
up vote 0 down vote accepted

I ended up creating a custom web part that allowed users to specify search criteria in the way I wanted with the validation I wanted. Doing this I was able to have values from a choice populated into a drop down list.

I then crafted a query string that could be used by the Core Search Results built in web part which I used to display the results.

Hope this helps someone!

share|improve this answer
    
Abe, can you post steps on how to achieve. I have similar requirement. Please its urgent –  user10986 Sep 27 '12 at 2:58

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.