SharePoint Search & update of LikeCount

Copper Contributor

We are currently creating a new SharePoint Intranet, for displaying the news we used the spfx search result webpart (https://github.com/SharePoint/sp-dev-solutions/tree/master/solutions/ModernSearch)

 

Currently we are hitting a limitation, perhaps someone here can help us: We want to display News-Title & Teaser with the number of Likes in the search results. Therefore we use the Managed Property "LikeCount". During our tests we noticed that the value wasn't updated correctly. Our current theory is: As "liking" a news doesn't change the LastModifiedDate the crawler doesn't notice something from this object has changed. Therefore the number of Likes is only updated after the news has been edited / the LastModifiedDate has changed.

 

Can someone confirm this behavior or has an idea for a workaround? The default News-Webpart is no option as we have some additional styling requirements.

4 Replies

@Markus IhloffI think your theory is right. To get the current real-time value for like count you should not depend on this Managed Property. A REST API is provided for you to inspect likes on a page. I think a good approach would be to create your own version of this SPFx WebPart and for each news item get the current like count by calling this API.

 

For more details on the API see the blog below for example:

https://www.eliostruyf.com/getting-likes-and-comments-from-modern-pages 

 

Hope this helps!

We too are seeing the exact same bug on both LikeCount and CommentCount. They remain out of date until the page is edited. The downside here is that the alternative doesn't work out well for us as we are trying to avoid having many requests/batching just to load this data for a bunch of results that come back from a search. I think your theory is correct, hopefully Microsoft can resolve this soon.

@Mike Morawski 

I'm not sure there will ever be a solution to this problem. I don't know how the crawler identifies which content needs an incremental crawl but I'm afraid that this would be a major change to the crawl-engine.

 

One way to work around this would be to trigger a Reindex for the Pages-Library on a regular base. But I'm not sure if you run into any throttling by Microsoft if you continously full-crawl several Libraries in SPO.

In our case we didn't find a solution to get it work, we'll remove the like count from the display template.

@Markus Ihloff I would imagine there is a service called as part of the publishing process to flag the page as needing a re-crawl. There is a chance that the social service could just call the same code. 

 

Added a user-voice https://sharepoint.uservoice.com/forums/330321-sharepoint-search/suggestions/38576434-have-sharepoin... maybe this will help get some traction. Others might very well be having the same issue.