0

Sitecore version: 9.3

In my SOLR, the name of my master core is M7_master_index.

I am trying to get some result from Sitecore using search. So I am creating the SearchContext in the following ways:

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

and

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

But at ContentSearchManager.GetIndex() I am getting the following error:

"Invalid cast from 'System.String' to 'Sitecore.ContentSearch.IFieldMap'."

   at System.Convert.DefaultToType(IConvertible value, Type targetType, IFormatProvider provider)
   at Sitecore.Reflection.ReflectionUtil.SetProperty(Object obj, PropertyInfo property, Object value)
   at Sitecore.Reflection.ReflectionUtil.SetProperty(Object obj, String name, Object value)
   at Sitecore.Configuration.DefaultFactory.AssignProperties(Object obj, Object[] properties)
   at Sitecore.Configuration.DefaultFactory.AssignProperties(XmlNode configNode, String[] parameters, Object obj, Boolean assert, Boolean deferred, IFactoryHelper helper)
   at Sitecore.Configuration.DefaultFactory.CreateObject(XmlNode configNode, String[] parameters, Boolean assert, IFactoryHelper helper)
   at Sitecore.Configuration.DefaultFactory.CreateObject(XmlNode configNode, String[] parameters, Boolean assert)
   at Sitecore.Configuration.DefaultFactory.CreateObject(String configPath, String[] parameters, Boolean assert)
   at Sitecore.Configuration.DefaultFactory.CreateFromReference(XmlNode configNode, String[] parameters, Boolean assert)
   at Sitecore.Configuration.DefaultFactory.CreateObject(XmlNode configNode, String[] parameters, Boolean assert, IFactoryHelper helper)
   at Sitecore.Configuration.DefaultFactory.CreateObject(XmlNode configNode, String[] parameters, Boolean assert)
   at Sitecore.Configuration.DefaultFactory.CreateObject(String configPath, String[] parameters, Boolean assert)
   at Sitecore.Configuration.DefaultFactory.CreateFromReference(XmlNode configNode, String[] parameters, Boolean assert)
   at Sitecore.Configuration.DefaultFactory.CreateObject(XmlNode configNode, String[] parameters, Boolean assert, IFactoryHelper helper)
   at Sitecore.Configuration.DefaultFactory.CreateObject(XmlNode configNode, String[] parameters, Boolean assert)
   at Sitecore.Configuration.DefaultFactory.GetInnerObject(XmlNode paramNode, String[] parameters, Boolean assert)
   at Sitecore.Configuration.DefaultFactory.AssignProperties(XmlNode configNode, String[] parameters, Object obj, Boolean assert, Boolean deferred, IFactoryHelper helper)
   at Sitecore.Configuration.DefaultFactory.CreateObject(XmlNode configNode, String[] parameters, Boolean assert, IFactoryHelper helper)
   at Sitecore.Configuration.DefaultFactory.CreateObject(XmlNode configNode, String[] parameters, Boolean assert)
   at Sitecore.Configuration.DefaultFactory.GetInnerObject(XmlNode paramNode, String[] parameters, Boolean assert)
   at Sitecore.Configuration.DefaultFactory.AssignProperties(XmlNode configNode, String[] parameters, Object obj, Boolean assert, Boolean deferred, IFactoryHelper helper)
   at Sitecore.Configuration.DefaultFactory.CreateObject(XmlNode configNode, String[] parameters, Boolean assert, IFactoryHelper helper)
   at Sitecore.Configuration.DefaultFactory.CreateObject(XmlNode configNode, String[] parameters, Boolean assert)
   at Sitecore.Configuration.DefaultFactory.CreateObject(String configPath, String[] parameters, Boolean assert)
   at Sitecore.ContentSearch.ContentSearchManager.get_SearchConfiguration()
   at Sitecore.ContentSearch.ContentSearchManager.GetIndex(String name)
0

Have been able to fix the issue. In the App.config default search engine was set to Azure which should not have been the case.

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