檢索多值字段我有類似下面Solrnet:無法從Solr的
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);
}
}
在我的schema.xml我字段映射爲一個模型:
<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"/>
我添加了一個列表共有5個產品Solr指數。如果我從Solr管理頁面查詢「*」,我得到這個響應文檔的結果之一:
<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>
然而,當我使用類似通過Solrnet查詢Solr的:
私人只讀ISolrReadOnlyOperations的Solr var results = solr.Query(SolrQuery.All);
我發現組件始終爲空。
任何幫助表示讚賞。
我可以看到任何派生集合的這種行爲。
我有'string []'類型(數組而不是派生List類型)工作多值屬性。 – Matej 2011-12-30 08:19:21
@Matej它適用於我的字符串[],但我不認爲我可以在這裏使用數組。派生List有其存在的理由。 – 2011-12-30 09:19:22