我使用 SOLR 作为我的搜索查询数据库。我目前的要求是将此文档发布到 SOLR 数据库上。
namespace SOLRApp
{
public class Table1Document
{
public Table1Document()
{
MobileNos = new List<int>();
EducationalDetails = new List<EducationalDetails>();
}
[SolrUniqueKey("ID")]
public string ID { get; set; }
[SolrField("FirstName")]
public string FirstName { get; set; }
[SolrField("LastName")]
public string LastName{ get; set; }
[SolrField("MobileNos")]
public List<int> MobileNos { get; set; }
[SolrField("EducationalDetails")]
public List<EducationalDetails> EducationalDetails { get; set; }
}
public class EducationalDetails
{
public EducationalDetails()
{
Details = new List<Details>();
}
public List<Details> Details { get; set; }
}
public class Details
{
[SolrField("IntitutionName")]
public string IntitutionName { get; set; }
[SolrField("EnrollDate")]
public DateTime EnrollDate { get; set; }
[SolrField("PassoutDate")]
public DateTime PassoutDate { get; set; }
[SolrField("InstituteRating")]
public int InstituteRating { get; set; }
}
}
为此,我添加了这个带有字段的模式文件,如下所示。
<field name="ID" type="int" indexed="true" stored="true"/>
<field name="FirstName" type="string" indexed="true" stored="true"/>
<field name="LastName" type="string" indexed="true" stored="true" />
<field name="MobileNos" type="string" indexed="true" stored="true" multiValued="true" />
<field name="EducationalDetails" type="EducationalDetails" indexed="true" stored="true" multiValued="true">
<field name="Details" type="string" indexed="true" stored="true" multiValued="true">
<field name="IntitutionName" type="string" indexed="true" stored="true"/>
<field name="EnrollDate" type="date" indexed="true" stored="true"/>
<field name="PassoutDate" type="date" indexed="true" stored="true"/>
<field name="InstituteRating" type="string" indexed="true" stored="true"/>
</field>
</field>
我想知道如何在 SOLR 中添加用户定义的数据类型。就像在我的示例中一样,“EducationalDetails”是用户定义的数据类型(类)。谁能告诉我如何在 SOLR 中添加它。
先感谢您。