|
|
@@ -421,14 +421,19 @@ public class IndexServiceImpl implements IndexService {
|
|
|
|
|
|
// 属性值加入索引,索引中field的键:"pr_"前缀连接属性的id
|
|
|
Set<PropertyValue> propertyValues = component.getProperties();
|
|
|
+ StringBuilder stringBuilder = new StringBuilder();
|
|
|
for (PropertyValue propertyValue : propertyValues) {
|
|
|
-
|
|
|
- // 为属性值每行记录的rowid建立索引,用于实时更新索引服务中
|
|
|
- // (属性值记录被删除时,无法根据DCN返回的属性值记录的rowid得知需要更新哪个器件的索引),
|
|
|
- // 通过该rowid从本地索引中获得相应器件的id,再根据该id从数据库中获取器件信息,更新本地索引
|
|
|
- document.add(new StringField(propertyValue.getRowid(), "1", Store.YES));
|
|
|
-
|
|
|
if (!StringUtils.isEmpty(propertyValue.getValue())) {
|
|
|
+ /*
|
|
|
+ * 将属性值每行记录的rowid拼接在一起建立索引, 用于实时更新索引服务中 (属性值记录被删除时,
|
|
|
+ * 无法根据DCN返回的属性值记录的rowid,得知需要更新哪个器件的索引),
|
|
|
+ * 通过该rowid,从本地索引中获得相应器件的rowid, 再根据该rowid从数据库中获取器件信息, 更新本地索引
|
|
|
+ */
|
|
|
+ stringBuilder.append(propertyValue.getRowid()).append(", ");
|
|
|
+ // TODO 删除
|
|
|
+ // document.add(new StringField(propertyValue.getRowid(), "1",
|
|
|
+ // Store.YES));
|
|
|
+
|
|
|
String fieldKey = SearchConstants.COMPONENT_PROPERTY_PREFIX + propertyValue.getPropertyid();
|
|
|
document.add(new StringField(fieldKey, propertyValue.getValue(), Store.YES));
|
|
|
|
|
|
@@ -437,6 +442,10 @@ public class IndexServiceImpl implements IndexService {
|
|
|
document.add(new TextField(fieldKeyTokenized, propertyValue.getValue(), Store.YES));
|
|
|
}
|
|
|
}
|
|
|
+ if (!StringUtils.isEmpty(stringBuilder.toString())) {
|
|
|
+ document.add(new TextField(SearchConstants.COMPONENT_PROPERTY_ROWIDS_FIELD, stringBuilder.toString(),
|
|
|
+ Store.YES));
|
|
|
+ }
|
|
|
return document;
|
|
|
}
|
|
|
|