我对Solr核心的乐观更新存在问题。核心已创建为具有一对多关系的父子结构。我正在尝试更新现有文档,但每次尝试更新都会因版本与消息冲突而失败;
{"msg":"version conflict for ZZFFG-BB8F-XXXX-8BCE-TYGSFSGHGHHH
expected=1525961521901862912 actual=-1","code":409}}
但是,我尝试更新的文档版本与我发布的文档版本相同,但由于某种原因,它未被识别。这是我发布到核心的文件;
{
"Content_Type": "parentDocument",
"Username": "xxxx.xxxxxxxxxxx",
"Email": "pp@test-europe.com",
"First Name": "XXXXXX",
"ParentContactId": "15448",
"Last Activity Date": "2007-10-10 10:49:14.0",
"Id": "ZZFFG-BB8F-XXXX-8BCE-TYGSFSGHGHHH",
"Surname": "YYYYYYYYYYY",
"_version_": 1525961521901862912,
_childDocuments_" [
{
"ChildContactId": "15448",
"Content_Type": "childDocument",
"Postcode": "GP7 8PT",
"Telephone": "01000 000000",
"Town": "TestVille",
"Dealer Number": "111",
"ParentCentreId": "1234",
"Name": "Testville Test"
}
]
}'
正如您所看到的,我发布的版本与错误消息中指定的预期版本相同 - 1525961521901862912。上面列出的更新文档是从更改的核心获取的,然后回发,这是可接受的方法。此方法适用于其他核心,但这些核心没有嵌套的父子结构。我已经尝试通过将版本ID设置为0来删除版本控制检查,但这会导致创建新记录,而不是更新。我还尝试添加“重复数据删除更新处理器”#39;这应该可以防止重复创建相同的签名字段但这没有任何效果。作为最后的手段,我甚至重新创建了核心,但问题仍然存在。 data-config包含在下面。任何帮助赞赏。感谢。
<dataConfig>
<dataSource type="JdbcDataSource"
driver="com.microsoft.sqlserver.jdbc.SQLServerDriver"
url="sqlserver://localhost"
user="Dev"
password="XXXXXXXXXX"/>
<document>
<entity
name="User"
pk="Id"
query="SELECT 'parentDocument' as 'Content_Type',
C.[Contact_id] as 'ParentContactId', S.[UserId] As Id,
S. [UserName], S.[LastActivityDate], C.[Contact_id],
C.[ForeName], C.[Surname], C.[Email]
FROM [Table1] as S
inner join .[Table2] as P on
S.[UserName] = P.[User_Name]
inner join [Table3] as C on
P.[Contact_id] = C.[Contact_id]
where (C.[Email] is not null and len(C.[Email])> 0)">
<field column="Content_Type" name="Content_Type"/>
<field column="ParentContactId" name="ParentContactId"/>
<field column="Id" name="Id"/>
<field column="UserName" name="Username"/>
<field column="LastActivityDate" name="Last Activity Date"/>
<field column="Contact_id" name="ContactId"/>
<field column="ForeName" name="First Name"/>
<field column="Surname" name="Surname"/>
<field column="Email" name="Email"/>
<entity
name="Centre"
pk="ChildContactId, Centre_id"
query="SELECT 'childDocument' as 'Content_Type',
CC.[Contact_id] as 'ChildContactId', CC.[Contact_id],
CenT.[Name], CenT.[Telephone],
Cen.[Centre_id] as 'ParentCentreId',
Cen.[Centre_id], Cen.[Dealer_No], Ad.[Town],
Ad.[Post_code]
From [Table4] CC
inner join [Table5] as CenT on
CC.Centre_id = CenT.Centre_id
inner join [Table6] as Cen on
CenT.Centre_id = Cen.Centre_id
inner join [Table7] as Ad on
Cen.[Address_id] = Ad.[Address_id]
where CC.[Contact_id] = ${User.Contact_id}"
child="true">
<field column="Content_Type" name="Content_Type"/>
<field column="ChildContactId" name="ChildContactId"/>
<field column="Contact_id" name="ContactId"/>
<field column="Name" name="Name"/>
<field column="Telephone" name="Telephone"/>
<field column="ParentCentreId" name="ParentCentreId"/>
<field column="Centre_id" name="Centreid"/>
<field column="Dealer_No" name="Dealer Number"/>
<field column="Town" name="Town"/>
<field column="Post_code" name="Postcode"/>
</entity>
</entity>
</document>
</dataConfig>