SC 8.2 Update 7 Search Issues with Contains

After upgrading to 8.2 Update 7  the Search functionality (Lucene) isn't working anymore - all methods which have predicates with ".Contains " started to throw error Unsupported Guid Method ToString in Sitecore.ContentSearch.Linq.

The indexes are rebuilded , the link db is rebuilded. Any ideas?

 

Server Error in '/' Application.
Unsupported guid method: ToString.
Description: An unhandled exception occurred. 

Exception Details: System.NotSupportedException: Unsupported guid method: ToString.

Source Error: 

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace: 


[NotSupportedException: Unsupported guid method: ToString.]
   Sitecore.ContentSearch.Linq.Parsing.ExpressionParser.VisitGuidMethod(MethodCallExpression methodCall) +195
   Sitecore.ContentSearch.Linq.Parsing.ExpressionParser.VisitLikeMethod(MethodCallExpression methodCall) +244
   Sitecore.ContentSearch.Linq.Parsing.ExpressionParser.VisitBinary(BinaryExpression expression) +72
   Sitecore.ContentSearch.Linq.Parsing.ExpressionParser.VisitBinary(BinaryExpression expression) +72
   Sitecore.ContentSearch.Linq.Parsing.ExpressionParser.VisitBinary(BinaryExpression expression) +72
   Sitecore.ContentSearch.Linq.Parsing.ExpressionParser.VisitBinary(BinaryExpression expression) +72
   Sitecore.ContentSearch.Linq.Parsing.ExpressionParser.VisitBinary(BinaryExpression expression) +92
   Sitecore.ContentSearch.Linq.Parsing.ExpressionParser.VisitBinary(BinaryExpression expression) +92
   Sitecore.ContentSearch.Linq.Parsing.ExpressionParser.VisitWhereMethod(MethodCallExpression methodCall) +160
   Sitecore.ContentSearch.Linq.Parsing.ExpressionParser.VisitSkipMethod(MethodCallExpression methodCall) +65
   Sitecore.ContentSearch.Linq.Parsing.ExpressionParser.VisitTakeMethod(MethodCallExpression methodCall) +65
   Sitecore.ContentSearch.Linq.Parsing.ExpressionParser.VisitGetResultsMethod(MethodCallExpression methodCall) +66
   Sitecore.ContentSearch.Linq.Parsing.ExpressionParser.Parse(Expression expression) +23
   Sitecore.ContentSearch.Linq.Parsing.GenericQueryable`2.GetQuery(Expression expression) +197
   Sitecore.ContentSearch.Linq.Parsing.GenericQueryable`2.Execute(Expression expression) +37
   Sitecore.ContentSearch.Linq.QueryableExtensions.GetResults(IQueryable`1 source, GetResultsOptions options) +373

  • I realize this is an old post, but here's a solution that worked for me.

    Change something like this, which breaks:
    predicate = predicate.And(x => x.MyStringList.Contains(model.MyGuid.ToString("N")));

    to this:
    var myGuidString = model.MyGuid.ToString("N");
    predicate = predicate.And(x => x.MyStringList.Contains(myGuidString));

    For instances where you have a Sitecore ID, you can use Sitecore.ContentSearch.Utilities.IdHelper.NormalizeGuid()

    like so:
    predicate = predicate.And(x => x.MyStringList.Contains(IdHelper.NormalizeGuid(model.MySitecoreID)));

    This works as well:
    model.Services.ToList().ForEach(x =>
    {
          servicePredicate = servicePredicate.Or(y => y.Services.Contains(IdHelper.NormalizeGuid(x.Id)));
    });