修复同一模型被多个数据集引用时: (#2183)

This commit is contained in:
iridescentpeo
2025-03-23 14:14:08 +08:00
committed by GitHub
parent 2e81b190a4
commit db8f340e2d
3 changed files with 9 additions and 1 deletions

View File

@@ -22,4 +22,9 @@ public abstract class MapResult implements Serializable {
return this.getMapKey().equals(otherResult.getMapKey()) return this.getMapKey().equals(otherResult.getMapKey())
&& this.similarity < otherResult.similarity; && this.similarity < otherResult.similarity;
} }
public Boolean lessOrEqualSimilar(MapResult otherResult) {
return this.getMapKey().equals(otherResult.getMapKey())
&& this.similarity <= otherResult.similarity;
}
} }

View File

@@ -75,6 +75,8 @@ public class MetaEmbeddingService {
return dataSetIds.stream().map(dataSetId -> { return dataSetIds.stream().map(dataSetId -> {
Retrieval newRetrieval = new Retrieval(); Retrieval newRetrieval = new Retrieval();
BeanUtils.copyProperties(retrieval, newRetrieval); BeanUtils.copyProperties(retrieval, newRetrieval);
HashMap<String, Object> newMetadata = new HashMap<>(retrieval.getMetadata());
newRetrieval.setMetadata(newMetadata);
newRetrieval.getMetadata().putIfAbsent("dataSetId", newRetrieval.getMetadata().putIfAbsent("dataSetId",
dataSetId + Constants.UNDERLINE); dataSetId + Constants.UNDERLINE);
return newRetrieval; return newRetrieval;

View File

@@ -56,7 +56,8 @@ public abstract class BaseMatchStrategy<T extends MapResult> implements MatchStr
for (T oneRoundResult : oneRoundResults) { for (T oneRoundResult : oneRoundResults) {
if (existResults.contains(oneRoundResult)) { if (existResults.contains(oneRoundResult)) {
boolean isDeleted = existResults.removeIf(existResult -> { boolean isDeleted = existResults.removeIf(existResult -> {
boolean delete = existResult.lessSimilar(oneRoundResult); // boolean delete = existResult.lessSimilar(oneRoundResult);
boolean delete = existResult.lessOrEqualSimilar(oneRoundResult);
if (delete) { if (delete) {
log.debug("deleted existResult:{}", existResult); log.debug("deleted existResult:{}", existResult);
} }