5

I'm re-posting because the other thread on with 'GetResults' instead of 'Filter' SOLR error message is in a different context. This thread was when migrating from 8.1 to 8.2, while we are migrating for 9 which already includes the patch.

So, for a search code that was working well on our 8.1, the same code on 9 is now producting this error:

ManagedPoolThread #8 17:00:23 ERROR There is no method 'Filter' on type 'Sitecore.ContentSearch.Linq.QueryableExtensions' that matches the specified arguments
Exception: System.InvalidOperationException
Message: There is no method 'Filter' on type 'Sitecore.ContentSearch.Linq.QueryableExtensions' that matches the specified arguments
Source: System.Core
   at System.Linq.EnumerableRewriter.FindMethod(Type type, String name, ReadOnlyCollection`1 args, Type[] typeArgs, BindingFlags flags)
   at System.Linq.EnumerableRewriter.VisitMethodCall(MethodCallExpression m)
   at System.Linq.Expressions.OldExpressionVisitor.VisitExpressionList(ReadOnlyCollection`1 original)
   at System.Linq.EnumerableRewriter.VisitMethodCall(MethodCallExpression m)
   at System.Linq.Expressions.OldExpressionVisitor.VisitExpressionList(ReadOnlyCollection`1 original)
   at System.Linq.EnumerableRewriter.VisitMethodCall(MethodCallExpression m)
   at System.Linq.Expressions.OldExpressionVisitor.VisitExpressionList(ReadOnlyCollection`1 original)
   at System.Linq.EnumerableRewriter.VisitMethodCall(MethodCallExpression m)
   at System.Linq.Expressions.OldExpressionVisitor.VisitExpressionList(ReadOnlyCollection`1 original)
   at System.Linq.EnumerableRewriter.VisitMethodCall(MethodCallExpression m)
   at System.Linq.Expressions.OldExpressionVisitor.VisitExpressionList(ReadOnlyCollection`1 original)
   at System.Linq.EnumerableRewriter.VisitMethodCall(MethodCallExpression m)
   at System.Linq.Expressions.OldExpressionVisitor.VisitExpressionList(ReadOnlyCollection`1 original)
   at System.Linq.EnumerableRewriter.VisitMethodCall(MethodCallExpression m)
   at System.Linq.EnumerableExecutor`1.Execute()
   at Sitecore.ContentSearch.Linq.QueryableExtensions.GetResults[TSource](IQueryable`1 source)

Thank you

PS: code example:

private IEnumerable<SearchManagerResultItem> generateResults(int pageNumber, out int totalResultCount)
        {
            var srchQuery = this.OnGetInitialQuery();

            // Query additions
            srchQuery = this.OnAddQueryBaseConditions(srchQuery);
            srchQuery = this.OnAddQuerySearchTerm(srchQuery);
            srchQuery = this.OnAddQueryLocations(srchQuery);
            srchQuery = this.OnAddQueryTemplates(srchQuery);
            srchQuery = this.OnAddQueryExcludedIDs(srchQuery);
            srchQuery = this.OnAddQueryDynamicFilters(srchQuery);
            srchQuery = this.OnAddQuerySorting(srchQuery);

            // Get the results
            pageNumber = pageNumber < 0 ? 0 : pageNumber;
            var srchResults = srchQuery.Page(pageNumber, this.PageSize).GetResults();

And the Visual Studio F12 "Go to definition" on srchQuery.Page

using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Runtime.CompilerServices;

namespace Sitecore.ContentSearch.Linq
{
    public static class QueryableExtensions
    {
        public static IQueryable<TSource> FacetOn<TSource, TKey>(this IQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector);
        public static IQueryable<TSource> FacetOn<TSource, TKey>(this IQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, int minimumResultCount);
        public static IQueryable<TSource> FacetOn<TSource, TKey>(this IQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, int minimumResultCount, IEnumerable<object> filterValues);
        public static IQueryable<TSource> FacetPivotOn<TSource>(this IQueryable<TSource> source, Expression<Func<FacetPivotQuery<TSource>, FacetPivotQuery<TSource>>> keySelector);
        public static IQueryable<TSource> FacetPivotOn<TSource>(this IQueryable<TSource> source, Expression<Func<FacetPivotQuery<TSource>, FacetPivotQuery<TSource>>> keySelector, int minimumResultCount);
        public static IQueryable<TSource> Filter<TSource>(this IQueryable<TSource> source, Expression<Func<TSource, bool>> predicate);
        public static FacetResults GetFacets<TSource>(this IQueryable<TSource> source);
        public static SearchResults<TSource> GetResults<TSource>(this IQueryable<TSource> source);
        public static SearchResults<TSource> GetResults<TSource>(this IQueryable<TSource> source, GetResultsOptions options);
        public static IQueryable<TSource> Page<TSource>(this IQueryable<TSource> source, int page, int pageSize);
        public static IQueryable<TOuter> SelfJoin<TOuter, TInner, TKey>(this IQueryable<TOuter> outer, IEnumerable<TInner> inner, Expression<Func<TOuter, TKey>> outerKeySelector, Expression<Func<TInner, TKey>> innerKeySelector);
        public static IEnumerable<TSource> Stream<TSource>(this IQueryable<TSource> source);
        public static IEnumerable<TSource> Stream<TSource>(this IQueryable<TSource> source, int pageSize);
    }
}
3
  • Can you post a code example here? – Richard Seal Jul 2 '18 at 17:42
  • Yes Richard, just edited - see the "PS:".. Let know if more is needed. Thank you. – Coeur Dusite Jul 2 '18 at 18:45
  • If your problem is solved and no one has provided an answer, feel free to write an answer yourself. Don't let this go unanswered please. – Pete Navarra Nov 30 '18 at 22:47
3

I ran into this same issue the other day. The cause of the issue is the same as in the GetResults thread. Solr needs to be running before you start Sitecore. Just do an iisreset to resolve the problem.

2
  • Thanks Corey, I believe it was done. At this point we no longer have the "Filter" error message, after this workaround: "The issue was due to the combination of .Filter() and .OrderBy() clauses. We changed .Filter() to .Where() which bypassed the issue." But we do now have the "GetResults" version of the error message. I'll reconfirm that Solr was running before Sitecore was restarted.. – Coeur Dusite Jul 3 '18 at 15:56
  • Corey and @CoeurDusite - my local Sitecore is reaching out to a remote Solr, which I confirmed is running by going to http:hostname.com:port/solr ... but still this error. I updated the ContentSearch.Solr.ServiceBaseAddress config element in Sitecore.ContentSearch.Solr.DefaultIndexConfiguration.config to point to the remote Solr – Don Cheadle Mar 18 '19 at 16:26

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.