1

For one of the Projects, i have to make some modifications in SharePoint search. I have a search center site and using results.aspx page, I am showing only documents.

There are about 5-6 content types being leveraged throughout the document libraries across all the subsites. Content type names are as follows: Lease, Legal, Loans etc. if the user types Lease in the search box then they should only see documents that have Lease populated as content type similarly if searched keyword is Legal then it should only show documents that are tagged with Content type as Legal.

Currently the search is returning documents that has lease as part of title, description and Lease populated as content type. But I only want to see documents relevant to content type.

Is this doable? if yes please help me with the steps to prioritize results by Content type. Thanks in advance.

2

May I suggest that you either add a search vertical/scope for the content types or add content type as a refiner as it really improves the search experience

If you create a search scope for each of the content types you can ensure that the results will never mix the content types. However that solution will require that you either updates the search result source or query once new content types are added. The refiner option is maintanence free but will not initially ensure that content types are not mixed

Edit: another option could be to create a query rule for each of the content types, so one of the rules will be triggered when the user enters "lease". In the query rule you boost the xrank of the content type Lease, see search explained for details : https://searchexplained.com/how-to-sort-search-results-by-using-query-rules/

  • Thanks Kasper. Are you saying that there is no way to prioritize search via content type. Each site search box is linked to results.aspx page so I add refiners its going to add one more step for users. First they have to type in search keyword in the search box and then on results.aspx they have to choose Lease as refiner. Can't it pick Lease from the search box itself and get the users refined results? – mdevm Jul 19 '18 at 17:41
  • Sure, if you can teach them to write "content type: lease" peugeot in the search box ;-) I think the best approach will a search vertical per content type as in blogs.technet.microsoft.com/tothesharepoint/2013/11/12/… – Kasper Bo Larsen Jul 19 '18 at 17:57
  • Hi Kasper, that's a great article and suggestions. However when I tried this: "content type : Lease" in search box, it returned nothing even though there are plenty of documents tagged with Lease. – mdevm Jul 20 '18 at 14:49
  • That syntax was just fake code. The proper syntax should be [internal field name] : [value]. Like Lease:"building" , if the field is a text field. I usually use the Sharepoint search query tool to test out the proper query – Kasper Bo Larsen Jul 20 '18 at 15:04
  • Kasper, One question though, is there no way to have them type Lease in search box and they should see all Lease Content type tagged documents? I guess the other way around would be show content types as refiners, not sure if it would work. Also, I am open to modify something like this from the query builder: If searched keyword is Lease then show lease contenttype docs. The content types are fixed and won't change so I can even hardcode them if required. – mdevm Jul 20 '18 at 15:57

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.