7

We are using Solr for indexing. We recently upgraded from Sitecore version 8.1 update 2 to 8.2 update 5. After upgrading when a search is performed we get the following error:

There is no method 'GetResults' on type 'Sitecore.ContentSearch.Linq.QueryableExtensions' that matches the specified arguments

Here is the relevant code:

var csmIndex = ContentSearchManager.GetIndex(index);
using (var context = csmIndex.CreateSearchContext(Sitecore.ContentSearch.Security.SearchSecurityOptions.DisableSecurityCheck))
{
    var query = context.GetQueryable<CustomSearchResult>();
    query = query.Where(i => i.SearchContent.Contains(search) || i.SearchTitle.Contains(search) || i.Url.Contains(search));
    if(facilityID != default(ID))
    {
        query = query.Where(i => i.FacilityId == facilityID);
    }

    query = query.Page(page - 1, pageSize);
    var items = query.GetResults();
}

I decompiled Sitecore.ContentSearch.Linq.dll and verified the method exists. I am getting no compliation errors. I'm not sure what has changed between versions that would cause this.

5
  • Is your Solr instance running and accessible? I had a support ticket for a similar error recently, except it was for the FacetOn method. The response from support was that it was due to Solr not being available.
    – Ben Golden
    Dec 8, 2017 at 20:23
  • Yes, I can connect to the Solr Admin in my browser and see the core. I'm also able to rebuild the index within Sitecore. Dec 8, 2017 at 20:33
  • Could you share your CustomSearchResult model? Dec 8, 2017 at 21:01
  • This actually appears to be environmental. Solr is crashing because it's looking for a segment file in the sitecore_suggested_test_index that doesn't exist. Dec 8, 2017 at 22:52
  • 1
    We also had this error on two of our development servers. At first I checked and verified DLL versions, .NET Runtime versions, etc. and assumed that the problem is to find there. After a while I found this thread and checked the SOLR instance which was offline. So if you also encounter this error, make sure to check your SOLR instance. The error message here is just very bad.
    – M. Fischer
    Jan 17, 2018 at 14:56

3 Answers 3

7

I recently contacted Sitecore support regarding this and a few other issues with Solr.

Regarding your exception I got this answer:

The error is related to the fact that Solr provider is not initialized before extracting GetResults() method. And it can happen in two cases:

  1. When Solr is turned off before starting of Sitecore
  2. Due to the possible delays in pipeline which can be before initializing Solr provider.

Regarding the first case, please note, that this exception only the result, not the cause of the missing connection to Solr, and does not affect Sitecore functionality in any way.

Regarding the second case please try to change the order of processors in the initialize pipeline in a following way. It should prevent the appearing of such errors due to delays in initialize pipeline.

Here is the patch that I prapared for this second case:

<sitecore>
  <pipelines>
    <initialize>
      <processor type="Sitecore.ContentSearch.SolrProvider.Pipelines.Loader.InitializeSolrProvider, Sitecore.ContentSearch.SolrProvider">
        <patch:delete />
      </processor>
      <processor type="Sitecore.ContentSearch.SolrProvider.Pipelines.Loader.InitializeSolrProvider, Sitecore.ContentSearch.SolrProvider" patch:before="*[@type='Sitecore.Pipelines.Loader.InitializeScheduler, Sitecore.Kernel']"/>
    </initialize>
  </pipelines>
</sitecore>

We test it on UAT, but so far this exception is gone.

3
  • 1
    #1 was my issue. Restarted IIS on my local, while the Solr service running, the GetResults() error went away
    – Rob Scott
    Mar 7, 2019 at 15:26
  • what config file would that pipelines XML snippet go into? Mar 18, 2019 at 19:31
  • you can put that into the new config patch. Mar 20, 2019 at 10:17
2

After digging deeper it turns out that the they are using Solr version 5.5.0. This appears to be leading to the known issue identified in the Solr compatibility table.

We'll see what happens after upgrading Solr.

1
  • so was this the fix? what happened next? (you can accept your own answer btw) Mar 18, 2019 at 2:10
2

This could also be shown when your ServiceBaseAddress is wrong in Sitecore.ContentSearch.Solr.DefaultIndexConfiguration.config

I had to change my address from https://xxx/solr/ to https://xxx/solr (removed the last /)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.