|
|
@@ -35,7 +35,7 @@ import com.uas.search.console.dao.KindSimpleInfoDao;
|
|
|
import com.uas.search.console.model.BrandSimpleInfo;
|
|
|
import com.uas.search.console.model.ComponentSimpleInfo;
|
|
|
import com.uas.search.console.model.KindSimpleInfo;
|
|
|
-import com.uas.search.console.model.PropertyValue;
|
|
|
+import com.uas.search.console.model.PropertyValueSimpleInfo;
|
|
|
import com.uas.search.console.service.IndexService;
|
|
|
import com.uas.search.console.support.IndexWriterManager;
|
|
|
import com.uas.search.console.util.SearchConstants;
|
|
|
@@ -270,9 +270,9 @@ public class IndexServiceImpl implements IndexService {
|
|
|
List<ComponentSimpleInfo> components = pageResult.getContent();
|
|
|
for (ComponentSimpleInfo component : components) {
|
|
|
// 属性值的value为空,不写入索引
|
|
|
- Set<PropertyValue> properties = component.getProperties();
|
|
|
- Set<PropertyValue> removingProperties = new HashSet<>();
|
|
|
- for (PropertyValue property : properties) {
|
|
|
+ Set<PropertyValueSimpleInfo> properties = component.getProperties();
|
|
|
+ Set<PropertyValueSimpleInfo> removingProperties = new HashSet<>();
|
|
|
+ for (PropertyValueSimpleInfo property : properties) {
|
|
|
if (StringUtils.isEmpty(property.getValue())) {
|
|
|
removingProperties.add(property);
|
|
|
}
|
|
|
@@ -420,19 +420,17 @@ public class IndexServiceImpl implements IndexService {
|
|
|
document.add(new StringField(SearchConstants.COMPONENT_ROWID_FIELD, component.getRowid(), Store.YES));
|
|
|
|
|
|
// 属性值加入索引,索引中field的键:"pr_"前缀连接属性的id
|
|
|
- Set<PropertyValue> propertyValues = component.getProperties();
|
|
|
+ Set<PropertyValueSimpleInfo> propertyValues = component.getProperties();
|
|
|
StringBuilder stringBuilder = new StringBuilder();
|
|
|
- for (PropertyValue propertyValue : propertyValues) {
|
|
|
+ for (PropertyValueSimpleInfo propertyValue : propertyValues) {
|
|
|
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));
|
|
|
+ // 将rowid中的符号+和空格替换为_,并以空格将rowid隔开
|
|
|
+ stringBuilder.append(propertyValue.getRowid().replaceAll("[ +]+", "_")).append(" ");
|
|
|
|
|
|
String fieldKey = SearchConstants.COMPONENT_PROPERTY_PREFIX + propertyValue.getPropertyid();
|
|
|
document.add(new StringField(fieldKey, propertyValue.getValue(), Store.YES));
|