Resolve "PostTitle Lookup Field is Blank " Issue In Blog Site Comments List

In SharePoint 2013 OnPremise, recently we faced one strange problem with a blog site comments list. The problem was, the hidden lookup field “PostTitle” in the comments list was not storing respectivethe post title reference after adding any comment against that post. And hence comments were not visible below such posts.

comment
When Googled for this issue, we found  the most likely solution as “recycling app pool.”

We tried many different solutions to resolve it but none of them helped. To name a few, we triedthe  following solutions:

  1. Checked app pool recycling. But it was already set to run every morning.
  2. Tried clearing distributed cache.
  3. Tried adding PostTitle field explicitly in Comments list content type (Ideally "PostTitle" field is hidden).
  4. Tried repairing "PostTitle" lookup column for connecting to a Comments list again as mentioned in this thread

After a long time banging our head against the issue, one of our team members  have luckily observed one strange behavior during troubleshooting.

The issue was with Querystring parameter (“id”) for post.aspx url when opening any particular post. Querystring parameter “id” was in lower case.

parameter

When tried it with uppercase  -- which means making it as “ID” --  the issue with comments disappeared.

parameter

The actual issue was with one Managed Property “SitePath” which was forming and returning “id” in lower case in a Post url inside a display template (for “Content By Search Webpart”).

We replaced lower case “id” with upper case “ID” in display template and uploaded it in gallery. Now the results inthe CBS webpart were showing Post url with upper case “ID.”

All comments after redirection from this new post url were showing “Post Title” field correctly in the Comments list and hence those Comments (for which “Post Title” field was not empty) were visible correctly below the particular post. 

comments

We were not able to trace the root cause for this behavior. But it looks like SharePoint internally (while forming a query to fetch PostTitle reference) considers Querystring valid only if it is mentioned as “ID” in post url.

I hope this will definitely save somebody’s day, week, or even a month.