|
@@ -91,10 +91,11 @@ public class ArticleService {
|
|
|
wrapper.like(Article::getTitle, keyword.trim());
|
|
wrapper.like(Article::getTitle, keyword.trim());
|
|
|
}
|
|
}
|
|
|
if (dimensionCode != null && !dimensionCode.trim().isEmpty()) {
|
|
if (dimensionCode != null && !dimensionCode.trim().isEmpty()) {
|
|
|
|
|
+ String dim = dimensionCode.trim();
|
|
|
// P1: 权重感知查询 — 匹配 dimension_weights > 0 或兼容旧版 relatedDimensions
|
|
// P1: 权重感知查询 — 匹配 dimension_weights > 0 或兼容旧版 relatedDimensions
|
|
|
wrapper.and(w -> w
|
|
wrapper.and(w -> w
|
|
|
- .apply("COALESCE(JSON_EXTRACT(dimension_weights, '$." + dimensionCode.trim() + "'), 0) > 0")
|
|
|
|
|
- .or().like(Article::getRelatedDimensions, dimensionCode.trim())
|
|
|
|
|
|
|
+ .apply("COALESCE(JSON_EXTRACT(dimension_weights, CONCAT('$.', {0})), 0) > 0", dim)
|
|
|
|
|
+ .or().like(Article::getRelatedDimensions, dim)
|
|
|
);
|
|
);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -122,10 +123,11 @@ public class ArticleService {
|
|
|
.last("LIMIT " + Math.max(size, 50));
|
|
.last("LIMIT " + Math.max(size, 50));
|
|
|
|
|
|
|
|
if (dimensionCode != null && !dimensionCode.trim().isEmpty()) {
|
|
if (dimensionCode != null && !dimensionCode.trim().isEmpty()) {
|
|
|
|
|
+ String dim = dimensionCode.trim();
|
|
|
// P1: 权重感知查询 — 匹配 dimension_weights > 0 或兼容旧版 relatedDimensions
|
|
// P1: 权重感知查询 — 匹配 dimension_weights > 0 或兼容旧版 relatedDimensions
|
|
|
wrapper.and(w -> w
|
|
wrapper.and(w -> w
|
|
|
- .apply("COALESCE(JSON_EXTRACT(dimension_weights, '$." + dimensionCode.trim() + "'), 0) > 0")
|
|
|
|
|
- .or().like(Article::getRelatedDimensions, dimensionCode.trim())
|
|
|
|
|
|
|
+ .apply("COALESCE(JSON_EXTRACT(dimension_weights, CONCAT('$.', {0})), 0) > 0", dim)
|
|
|
|
|
+ .or().like(Article::getRelatedDimensions, dim)
|
|
|
);
|
|
);
|
|
|
}
|
|
}
|
|
|
|
|
|