• Not Answered

SOLR for new site works in Edit not Production

A while back due to time constraints [I'm a team of one ;)] we had a consultant come in and upgrade us to Sitecore.NET 8.2 (rev. 170728) and to use SOLR instead of Coveo.  The SOLR search setup was covered; I thought I understood it, but apparently I missed something.  Any help is much appreciated, I feel it's a simple thing I'm missing, but I've spent too long already on figuring it out.

We have an edit server behind the firewall and a production server in the DMZ.  The search works fine in edit whether I point the index to master or web.  The search does not work in production server for the new site when pointing to web index.  Works for the new site when pointing to master index and still works for the existing sites that were upgraded by consultant.

I checked all the SOLR config files and they match other than edit is <Database>master</Database> is and production is <Database>web</Database>.  No error are showing in the "Search.log....txt" file.  I've rebuilt the indexes using Sitecore and it reflects that based on timestamp in the SOLR admin in both edit and production. Same exact code and Sitecore items are in edit (index) and production (web); nothing appears to be missing.

The issue is with a custom computed index field. Using production SOLR website admin search and I remove "AND haslayout_s:(1)" for sitecore_web_index I get results. If I leave "AND haslayout_s:(1)" in for sitecore_master_index I get results. The weird thing is for the same item in edit sitecore_web_index it is "haslayout_s": "1", but production sitecore_web_index it is "haslayout_s": "0"

Here is an example of the search from the log.

(((title_t:(reference))^7 OR (urllink_t:(*reference*))^6 OR (title_t:(*reference*))^4 OR (parsedpagecontent_t:(*reference*))^2) AND (((_language:(en) AND haslayout_s:(1)) AND (-excludefromsearchresults_b:(True) *:*)) AND _path:(47099c18768040d587a9f8a69a7ac8fb)))

Here is the custom computed field code which is used by the existing sites and new site:

public class HasLayout : IComputedIndexField
{
  public object ComputeFieldValue(IIndexable indexable)
  {
    var indexableItem = indexable as SitecoreIndexableItem;

    if (indexableItem == null)
      return "0";
    else
      return indexableItem.Item.Visualization.Layout == null ? "0" : "1";
  }
  public string FieldName { get; set; }
  public string ReturnType { get; set; }
}