SOLVED

SharePoint Online - How can I add managed properties to search results?

Brass Contributor

Dear Ladies and Gentlemen,

 

How can I add managed properties to search results in SharePoint Online?

 

I have some crawled properties matched with manged properties and also with refinable properties like RefinableString01.

 

I have also created custom search result page.

 

I have also updated the CustomString.js file like that:

 

// Add your custom localized strings and then include these string dictionaries in your display templates using the $includeLanguageScript function
 
$registerResourceDictionary("en-us", {
        "sampleCustomStringId": "Sample custom string",
        "rf_RefinementTitle_ManagedPropertyName": "Sample Refinement Title for ManagedPropertyName",
"rf_RefinementTitle_RefinableString01": "Document ID",
"rf_RefinementTitle_RefinableString02": "Document ID URL",
"rf_RefinementTitle_RefinableString03": "Project Name"
    });

 

But how ca I add these properties to the results of the search. So that these values will be displayed with the information about documents like title and URL address?

 

In the SharePoint Server it was possible to do.

 

Thank you

Ladislav Stupak

1 Reply
best response confirmed by LadislavStupak (Brass Contributor)
Solution

@LadislavStupak 

 

This video from Dan from Academy 365 helped me a lot:

 

SharePoint Tutorial - How to build a custom search page experience


https://www.youtube.com/watch?v=H4HMOnnfx2w

 

"PnP Modern Search v4" is used there and explained how it works. It is a very good solution.

 

https://microsoft-search.github.io/pnp-modern-search/ 

 

I have just made some changes, because I wanted to display more properties in the search results.

 

I have made these mappings in the SharePoint central administration under Search:

 

Managed PropertyCrawled PropertyDescription
RefinableString01ows__dlc_DocIdDocument ID
RefinableString02ows__dlc_DocIdUrlDocument ID URL
RefinableString03ows_ProjectNameSharePoint Library Choice Column "ProjectName" used in more Libraries.
RefinableString04ows__UIVersionStringLibrary Element Version.


I have made these mappings in the PnP Search Results Webpart under Layout slots:

 

Slot nameSlot fieldDescription
DlcDocIdRefinableString01Document ID
CustomDlcDocIdUrlRefinableString02Document ID URL
ProjectNameRefinableString03SharePoint Library Choice Column "ProjectName" used in more Libraries.
CustomUIVersionStringRefinableString04Library Element Version.

 

And I have added this code in the Tag object:

 

<div>
   {{#if (slot item @root.slots.CustomDlcDocIdUrl)}}
      <span></span><a href="{{RefinableString02}}">{{RefinableString01}}</a></span>
   {{/if}}
   {{#if (slot item @root.slots.CustomUIVersionString)}}
      <span>Version: {{RefinableString04}}</span>
   {{/if}}
   {{#if (slot item @root.slots.ProjectName)}}
      <span>{{RefinableString03}}</span>
   {{/if}}
</div>

 

 

In this video, I demonstrate how to build a custom search page within a SharePoint Online site. The search experience I have created in this video is based on the Netflix search experience (which I first demoed in my 'How to Build Netflix in SharePoint' video a few months ago). Some people had ...
1 best response

Accepted Solutions
best response confirmed by LadislavStupak (Brass Contributor)
Solution

@LadislavStupak 

 

This video from Dan from Academy 365 helped me a lot:

 

SharePoint Tutorial - How to build a custom search page experience


https://www.youtube.com/watch?v=H4HMOnnfx2w

 

"PnP Modern Search v4" is used there and explained how it works. It is a very good solution.

 

https://microsoft-search.github.io/pnp-modern-search/ 

 

I have just made some changes, because I wanted to display more properties in the search results.

 

I have made these mappings in the SharePoint central administration under Search:

 

Managed PropertyCrawled PropertyDescription
RefinableString01ows__dlc_DocIdDocument ID
RefinableString02ows__dlc_DocIdUrlDocument ID URL
RefinableString03ows_ProjectNameSharePoint Library Choice Column "ProjectName" used in more Libraries.
RefinableString04ows__UIVersionStringLibrary Element Version.


I have made these mappings in the PnP Search Results Webpart under Layout slots:

 

Slot nameSlot fieldDescription
DlcDocIdRefinableString01Document ID
CustomDlcDocIdUrlRefinableString02Document ID URL
ProjectNameRefinableString03SharePoint Library Choice Column "ProjectName" used in more Libraries.
CustomUIVersionStringRefinableString04Library Element Version.

 

And I have added this code in the Tag object:

 

<div>
   {{#if (slot item @root.slots.CustomDlcDocIdUrl)}}
      <span></span><a href="{{RefinableString02}}">{{RefinableString01}}</a></span>
   {{/if}}
   {{#if (slot item @root.slots.CustomUIVersionString)}}
      <span>Version: {{RefinableString04}}</span>
   {{/if}}
   {{#if (slot item @root.slots.ProjectName)}}
      <span>{{RefinableString03}}</span>
   {{/if}}
</div>

 

 

View solution in original post

In this video, I demonstrate how to build a custom search page within a SharePoint Online site. The search experience I have created in this video is based on the Netflix search experience (which I first demoed in my 'How to Build Netflix in SharePoint' video a few months ago). Some people had ...