我正在使用SolrNET来管理我的Solr索引。在使用名为“guid”的新uniqueKey字段更新架构后,我无法将文档添加到Solr。
这是Tomcat日志错误:
org.apache.solr.common.SolrException:文档缺少uniqueKey字段guid
我正在向Solr添加这样的对象:
return new T()
{
GUID = Guid.NewGuid().ToString(),
Id = reader.GetInt32(0),
Heading = reader.GetString(1),
Body = freeText,
ForumRoom = reader.GetInt32(3),
ForumTopicId = reader.GetInt32(9),
SearchObjectType = reader.GetBoolean(5) ? SearchBase.ObjectType.ForumReply.ToString() : SearchBase.ObjectType.ForumTopic.ToString(),
Date = reader.GetDateTime(6)
};
奇怪的是,这在测试本地时非常有效,但是根本不能正常工作。
这就是schema.config的样子:
<fields>
<field name="id" type="int" indexed="true" stored="true" required="true" />
<field name="searchobjecttype" type="string" indexed="true" stored="true" required="true" />
<field name="heading" type="text" indexed="true" stored="false" required="false" />
<field name="body" type="text" indexed="true" stored="false" required="false" />
<field name="locationid" type="int" indexed="true" stored="true" required="false" />
<field name="currentlocationid" type="int" indexed="true" stored="true" required="false" />
<field name="countryid" type="int" indexed="true" stored="true" required="false" />
<field name="currentcountryid" type="int" indexed="true" stored="true" required="false" />
<field name="forumroom" type="int" indexed="true" stored="true" required="false" />
<field name="forumtopicid" type="int" indexed="true" stored="true" required="false" />
<field name="dt" type="date" indexed="true" stored="false" required="false" />
<field name="txt" type="text" indexed="true" stored="true" multiValued="true" />
<field name="guid" type="string" indexed="true" stored="true" required="false" />
</fields>
<copyField source="id" dest="txt" />
<copyField source="searchobjecttype" dest="txt" />
<copyField source="heading" dest="txt" />
<copyField source="body" dest="txt" />
<copyField source="locationid" dest="txt" />
<copyField source="currentlocationid" dest="txt" />
<copyField source="countryid" dest="txt" />
<copyField source="currentcountryid" dest="txt" />
<copyField source="forumroom" dest="txt" />
<copyField source="forumtopicid" dest="txt" />
<copyField source="dt" dest="txt" />
<uniqueKey>guid</uniqueKey>
<defaultSearchField>txt</defaultSearchField>
<solrQueryParser defaultOperator="AND" />
我错过了什么?
答案 0 :(得分:0)
好的,这有点令人尴尬。我的网站调用了一个执行实际索引的Web服务。我已将主Web服务项目dll复制到实时服务器文件夹,但没有一个具有更新架构字段的帮助程序库..