5

Search results has no value for a custom site column.

Ok, so I have a lookup column created as a site column in the root of my site collection. I found the field in crawled properties. NOTE: I am limited to Site Collection Administrator permissions.

Crawled Property Name: ows_solDsDistricts

I added a Managed Property and mapped the ows_solDsDistricts.

According to what I saw on Channel 9, I edited the display template in the masterpage library and added the name of the managed property to the list of properties.

<mso:ManagedPropertyMapping msdt:dt="string">...

In the display template, I followed the pattern for the other properties. Here is the entry for the "Created By" column:

,&#39;DisplayAuthor&#39;:&#39;DisplayAuthor&#39;

Here is my custom property (using the name of my custom managed property):

,&#39;customSolDsDistricts&#39;:&#39;customSolDsDistricts&#39;

I added some vars in the template for both of the managed properties above.

var varDistrictName = ctx.CurrentItem.customSolDsDistricts;
var varDisplayAuthor = ctx.CurrentItem.DisplayAuthor;

Then added the references in the HTML of the template.

<div>District: _#=varDistrictName=#_</div>
<div>Created By: _#=varDisplayAuthor=#_</div>

When I search, the results return the varDisplayAuthor values but the varDistrictName is blank. It has been over 24hrs since I created the managed property.

I must be missing something. Yes, I have verified that all items in the search results do have values in the solDsDistricts site column.

  • Have you checked for a managed property that was created when the site column was created? Generally if you create a site column you shouldn't have to add a managed property manually. It could be possible that it's mapped to that rather than your custom one. – Jordan Apr 3 '15 at 14:06
  • Hmmm, maybe, I found a crawled property named "SharePoint:District_x0" that is mapped to the "ows_solDsDistricts:District_x0." This crawled property was not mapped to a managed property. I mapped my custom MP "customSolDsDistricts" to this CP "SharePoint:District_x0." I've waited about 10 minutes, still no results. – Arknev Apr 3 '15 at 15:59
1

I had the same issue and resolved it by copying the original display template and editing that one with my changes, then copying the original result type to create a new one that uses the new display template.

My guess is that either the display template or result type is caching the managed properties that are needed by the template. Creating new copies avoids this caching. There may be other ways to get around this short of creating new copies but this worked for me.

  • thanks mate, this trick helped me solved my problem! Best regards. – theITvideos Jun 4 '18 at 1:18
0

When you say your custom property is blank, you mean when you look at the result of the Search Results template using your modified Display template ? It may seem far fetch but have you tried "Using a single template to display items" and specifying the modified template in the Search Results Web part configuration?

  • I can verify that my template is being used in the search results because I see my basic template with the "District: " text as well as the "Created By: " text and the Author field value. Only the district value is missing. – Arknev May 29 '15 at 17:32
0

I had this issue and was able to resolve it by editing the properties of the item display template's .js in the Master Page gallery. The "Managed Property Mappings" field didn't include my custom managed property so I had to manually add it. I can't explain why it didn't get updated from the content of my .html file but at least I got it working.

0

I assume that this was a crawl issue. I don't have access to the Tenant Admin so I couldn't force an update. I came back to this later and all values were displayed as expected.

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.