SolrNet error message : Object of type 'System.Collections.ArrayList' cannot be converted to type 'System.String'.

Consider SorlSearchResult as your class
public class SolrSearchResult
    {
        [SolrUniqueKey("id")]
        public string Id { get; set; }
        
        [SolrField("title")]
        public string title { get; set; }

        [SolrField("author")]
        public string author { get; set; }
    }
Your issue is that the title  field in your SorlSearchResult class is defined as a string, yet in solr schema.xml you have defined the title field as multiValued="true" which allows for multiple entries in the solr document and is shown in your solr return value. 
<field name="title" type="text_general" indexed="true" stored="true" multiValued="true"/>                    
The error message is showing this mis-match because it cannot map an array of strings into a single string.
So you need to change the definition of this field to a collection like the following:
[SolrField("text")]
public ICollection<string> text { get; set; }
or remove multiValued="true"
<field name="title" type="text_general" indexed="true" stored="true"/>                    

Comments

Popular posts from this blog

SQL Interview Questions and Answers

Generic Interface and Factory Pattern in C#

How to get device info IMEI programmatically in xamarin android