ustom Layout Results Page to allow sorting and filtering by property

Content query webpart does not give the same flexibility as search results page to allow user to filter and sort by property.

SharePoint Online provides out of the box display template which can be used in results page. However if custom property needs to be displayed or a custom display format is needed , then a new search result page can be created.

Assuming news items need to be displayed in the following format with filters Country and Subject.

SearchResultPage

  1. Map Managed Metadata fields to managed properties                  Country and Subject are managed metadata fields. Two crawled properties are created per managed metadata fields. For example field country has two crawled properties ows_taxId_Country and ows_Country. The ows_FieldName format stores the friendly label and is not mapped by default. The latter can be mapped to the out of the box refinable string mapped properties.

RefinableStrings

2.  Create  Result Source for the news

NewsResultSource.png

3.Create a new result display template “Item_NewsArticle.html” by following the guide

http://www.ableblue.com/blog/archive/2013/06/05/introduction-to-sharepoint-2013-display-templates/

The Item_NewsArticle.js gets generated automatically.

Download Item_NewsArticle.html

  1. On the news article results page, ensure the search results web part uses the template “New Article Item” and the query use the ” All News Article” result source created in previous steps.

 

 

Advertisements