How to create custom search result source + display template
-
30-09-2020 - |
質問
This is the desired scenario:
User searches for something and if that something comes from a particular list, swap out the Search Result title(link), with the list item's Url
field.
If the search finds results from any other list, remove it from the results.
Is this possible? Thanks.
解決
You can use following query to get the result
path:"https://siteurl" (ListID:{CC6FB9E2-92CE-444E-85C7-2E126DFF9ED0} OR contentclass<>SPListItem OR)
The above query will give you all results which are not of type SPListItem
. If you observe there is an OR
condition where we are including search results from a single list. So in your case you should change the GUID
to the guid of your list.
Before you modify DisplayTemplate, you should include the Managed Property for Url
using mso:ManagedPropertyMapping
所属していません sharepoint.stackexchange