我收到错误:-无法将值“System.Collections.ArrayList”转换为文档类型 IKnowWhoKnowsSolrNet 的属性“专业化”
我的代码
//Initialise the solrNet Client.
var solr = ServiceLocator.Current.GetInstance<ISolrOperations<IKnowWhoKnowsSolrNet>>();
//Get the data from the ID.
var results = solr.Query(new SolrQueryByField("id", userName));//Error Place.
//Check the name is empty or not.
if (results.Count != 0)
{
//assign the areaSpecialisation value.
areaSpecialisation = results[0].Specialisation;
}
我在这里收到错误var results = solr.Query(new SolrQueryByField("id", userName));
如果我检查userName = bhagirathi但现在将用户名更改为userName = 123|bhagirathi|bhagi@abc.com ,它工作正常
它给出的错误。
[编辑]
区域属性
[SolrUniqueKey("id")]
public string UserName { get; set; }
[SolrField("features")]
public string Specialisation { get; set; }
#endregion
#region Constractor
public IKnowWhoKnowsSolrNet()
{
//
// TODO: Add constructor logic here
//
}
/// <summary>
/// Set the class property's value
/// </summary>
/// <param name="userDetails"></param>
/// <param name="areaSpecialisation"></param>
public IKnowWhoKnowsSolrNet(string userName, string areaSpecialisation)
{
UserName = userName;
Specialisation = areaSpecialisation;
}
#endregion
Id 是 solr 中的字符串。
[/编辑]
请通过简单地更改搜索查询来帮助为什么会出现此错误?
提前致谢。