9

How can I search by some keyword and show the results only from contenttype X? I am using sharepoint 2013.

UPDATE:

I would like to implement this in the search page and not in some search webpart. Because I would like to use also the refiners on the left of the search page.

enter image description here

7

You need to modify the search result web part to only display items of your content type. Just edit the properties of the web part and click "Change Query":

enter image description here

In quick mode, you can do a query for items by content type. Quick mode uses drop downs to create the query, and is rather easy.

enter image description here

In advanced mode, you can use keyword query language. There are some drop downs to help build the queries. The following gets all items that inherit from a content type: ContentTypeId:0x0100EEA1F5E3F2E1CA45983B2EAF52D90F4A*

enter image description here

  • 1
    And also This part can be used in KeywordQuery or Search API call as the query "ContentTypeId:0x0100EEA1F5E3F2E1CA45983B2EAF52D90F4A*". – Robert Lindgren Apr 21 '14 at 12:24
  • Thank you for this answer. I know this option, but I am looking for some solution on the search page. Because I would like to use also the refiners on the left. – Ola Apr 22 '14 at 9:40
  • @KHA This is on the search page. These changes can be made to the search result web part on the search page. My screenshots came from a content by search web part, but it's the same for a search results web part. – wjervis Apr 22 '14 at 11:58
  • Is it possible to make 2 search pages? One with your solution to change the query. And the other like how it is OOTB? – Ola Apr 22 '14 at 12:19
  • 2
    Just add a new page to the search center Pages library and then use the settings above. Add the page to the navigation verticals by modifying the Search Settings for the site. – Matthew McDermott Apr 22 '14 at 12:50
2

You could also just use the content type name by using the ContentType: query in the regular search: enter image description here

0

1) Create a custom Result Source.

2) In the Query Builder window, add the name of ContentType (e.g. Document)

{searchTerms} ContentType=Document

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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