2

I am migrating a project from 8.2 to 9, and moving indexes from Lucene to Solr. The default indexes are fine, but my custom index is throwing an exception:

53416 08:51:21 ERROR Unable to connect to [https://localhost:8983/solr], Core: [hostname-9u1_search_web_index]
Exception: SolrNet.Exceptions.SolrConnectionException
Message: <html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<title>Error 404 Not Found</title>
</head>
<body><h2>HTTP ERROR 404</h2>
<p>Problem accessing /solr/hostname-9u1_search_web_index/schema. Reason:
<pre>    Not Found</pre></p>
</body>
</html>

Source: SolrNet
   at SolrNet.Impl.SolrConnection.Get(String relativeUrl, IEnumerable`1 parameters)
   at Sitecore.ContentSearch.SolrNetExtension.Impl.SolrBasicServerEx`1.GetSchema(String collection)
   at Sitecore.ContentSearch.SolrProvider.SolrSearchIndex.InitializeSchema()
   at Sitecore.ContentSearch.SolrProvider.SolrSearchIndex.InitializeSolr()

Nested Exception

Exception: System.Net.WebException
Message: The remote server returned an error: (404) Not Found.
Source: System
   at System.Net.HttpWebRequest.GetResponse()
   at HttpWebAdapters.Adapters.HttpWebRequestAdapter.GetResponse()
   at SolrNet.Impl.SolrConnection.GetResponse(IHttpWebRequest request)
   at SolrNet.Impl.SolrConnection.Get(String relativeUrl, IEnumerable`1 parameters)

My configuration for the index as follows, which I've basically copied from the standard sitecore_web_index config and just change the id & core properties:

<configuration type="Sitecore.ContentSearch.ContentSearchConfiguration, Sitecore.ContentSearch">
    <indexes hint="list:AddIndex">
      <index id="search_web_index" type="Sitecore.ContentSearch.SolrProvider.SolrSearchIndex, Sitecore.ContentSearch.SolrProvider">
        <param desc="name">$(id)</param>
        <param desc="core">hostname-9u1_search_web_index</param>
        <param desc="propertyStore" ref="contentSearch/indexConfigurations/databasePropertyStore" param1="$(id)" />
        <configuration ref="contentSearch/indexConfigurations/defaultSolrIndexConfiguration" />
        <strategies hint="list:AddStrategy">
          <strategy ref="contentSearch/indexConfigurations/indexUpdateStrategies/onPublishEndAsyncSingleInstance" />
        </strategies>
        <locations hint="list:AddCrawler">
          <crawler type="Fundamentals.Feature.Search.Infrastructure.Crawlers.LayoutOnlyCrawler, Fundamentals.Feature.Search">
            <Database>web</Database>
            <Root>/sitecore/Content/SiteName/Home</Root>
          </crawler>
          <crawler type="Sitecore.ContentSearch.SitecoreItemCrawler, Sitecore.ContentSearch">
            <Database>web</Database>
            <Root>/sitecore/Media Library</Root>
          </crawler>
        </locations>
        <enableItemLanguageFallback>false</enableItemLanguageFallback>
        <enableFieldLanguageFallback>false</enableFieldLanguageFallback>
      </index>                    
    </indexes>
  </configuration>

I am new to Solr and my assumption is that this will work in the same way as Azure search; i.e defining the index in config will create the index in Solr without doing any configuration within Solr. Am I missing a step?

UPDATE As per the accepted answer, I was indeed missing a step - unlike Azure search, you need to create the indexes (cores) in Solr. However I had to do something slightly different to the blog post.

The blog post suggests there is a "sitecore_configs" configset - there wasn't in my case, and the config for each core was located within each index under a 'conf' folder. So I just had to copy the contents from the sitecore_web_index into a new folder called 'sitecore_configs'. Then I could call the URL as suggested. Then I used the 'Populate Solr Managed Schema' command from the control panel in Sitecore, and then rebuilt.

4
  • Did you check the Solr admin? Can you see the core there?
    – Gatogordo
    Commented Feb 2, 2018 at 9:19
  • No it's not there Commented Feb 2, 2018 at 9:19
  • Create the core, and try again..
    – Gatogordo
    Commented Feb 2, 2018 at 9:20
  • Get this: Error CREATEing SolrCore 'hostname-9u1_search_master_index': Unable to create core [hostname-9u1_search_master_index] Caused by: Can't find resource 'solrconfig.xml' in classpath or 'C:\Solr\solr-6.6.2\server\solr\hostname-9u1_search_master_index' Commented Feb 2, 2018 at 9:22

1 Answer 1

2

You do need to create your Solr core first. Pete Navarra wrote a nice post on setting up custom indexes with Solr.

You basically:

  1. Create your solr core (you can use the solr admin page for that)
  2. Add your config file with the custom index to Sitecore (and optionally the custom index configuration - but you seem to be using the default)
  3. Verify that your index is in the Indexing Manager and rebuild the index

ps: you will need to be able to create the core of course.. Pete's article has some information on the configsets, but solving your resource issue might be out of scope here. I think based on your error that the create is looking in the wrong place for it's config file.

3
  • Thanks that article was helpful - I had to do something slightly different, so I'll update my question with the details Commented Feb 2, 2018 at 10:02
  • Link to Pete Navarra post is dead. Commented Apr 5, 2021 at 19:36
  • 1
    Updated the link so it should be working again
    – Gatogordo
    Commented Apr 13, 2021 at 12:47

Your Answer

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

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