I have a model similar to below
public class Product
{
[SolrUniqueKey("id")]
public int ID { get; set; }
[SolrField("storage")]
public string Storage { get; set; }
[SolrField("components")]
public Components Components { get; set; }
}
public class Components : List<string>
{
public Components()
{}
public Components(string[] components)
{
AddRange(components);
}
}
In my schema.xml I map the fields as:
<field name="id" type="string" indexed="true" stored="true" required="true" />
<field name="storage" type="string" indexed="true" stored="true" omitNorms="true"/>
<field name="components" type="text_ws" stored="true" multiValued="true" omitNorms="true"/>
I've added a list of 5 products to Solr index. If I query from Solr admin page for "*", I get this response doc for one of the results:
<doc>
<arr name="components">
<str>blah1</str>
<str>blah2</str>
<str>blah3</str>
</arr>
<str name="id">0</str>
<str name="storage">foo</str>
</doc>
However, when I query Solr via Solrnet using something like:
private readonly ISolrReadOnlyOperations solr var results = solr.Query(SolrQuery.All);
I find that Components is always null.
Any help is appreciated.
I can see this behaviour for any derived collection.
string[]
type (array instead of derived List type). – Matej