Skip to main content
Add syntax highlighting hints.
Source Link
Corey Smith
  • 2.7k
  • 1
  • 22
  • 45

I recently upgraded from Sitecore v7.5 to v8.1. In addition my Solr configuration changed a little. On v7.5 I only had a single core. On v8.1 I now have many cores. After upgrading my search code is not returning any results and I am debugging it. I am wondering if maybe my code isn't searching the right Solr core. So I am wondering how the code knows which core to query.

Here is a code fragment for my search...

using (var context = ContentSearchManager.GetIndex("sitecore_web_index").CreateSearchContext()) {

   ... do search stuff
}
using (var context = ContentSearchManager.GetIndex("sitecore_web_index").CreateSearchContext()) {

   ... do search stuff
}

When I create the search context using that code am I telling the code to search through the core named "sitecore_web_index"? I guess it is unclear to me how the code knows which core to query.

I recently upgraded from Sitecore v7.5 to v8.1. In addition my Solr configuration changed a little. On v7.5 I only had a single core. On v8.1 I now have many cores. After upgrading my search code is not returning any results and I am debugging it. I am wondering if maybe my code isn't searching the right Solr core. So I am wondering how the code knows which core to query.

Here is a code fragment for my search...

using (var context = ContentSearchManager.GetIndex("sitecore_web_index").CreateSearchContext()) {

   ... do search stuff
}

When I create the search context using that code am I telling the code to search through the core named "sitecore_web_index"? I guess it is unclear to me how the code knows which core to query.

I recently upgraded from Sitecore v7.5 to v8.1. In addition my Solr configuration changed a little. On v7.5 I only had a single core. On v8.1 I now have many cores. After upgrading my search code is not returning any results and I am debugging it. I am wondering if maybe my code isn't searching the right Solr core. So I am wondering how the code knows which core to query.

Here is a code fragment for my search...

using (var context = ContentSearchManager.GetIndex("sitecore_web_index").CreateSearchContext()) {

   ... do search stuff
}

When I create the search context using that code am I telling the code to search through the core named "sitecore_web_index"? I guess it is unclear to me how the code knows which core to query.

Source Link
Corey Burnett
  • 3.4k
  • 3
  • 20
  • 36

How to specify Solr core in search code for Sitecore 8.1

I recently upgraded from Sitecore v7.5 to v8.1. In addition my Solr configuration changed a little. On v7.5 I only had a single core. On v8.1 I now have many cores. After upgrading my search code is not returning any results and I am debugging it. I am wondering if maybe my code isn't searching the right Solr core. So I am wondering how the code knows which core to query.

Here is a code fragment for my search...

using (var context = ContentSearchManager.GetIndex("sitecore_web_index").CreateSearchContext()) {

   ... do search stuff
}

When I create the search context using that code am I telling the code to search through the core named "sitecore_web_index"? I guess it is unclear to me how the code knows which core to query.