diff --git a/mateclaw-server/src/main/java/vip/mate/wiki/model/WikiPageEntity.java b/mateclaw-server/src/main/java/vip/mate/wiki/model/WikiPageEntity.java index a6cf03ad..78641cc6 100644 --- a/mateclaw-server/src/main/java/vip/mate/wiki/model/WikiPageEntity.java +++ b/mateclaw-server/src/main/java/vip/mate/wiki/model/WikiPageEntity.java @@ -65,6 +65,14 @@ public class WikiPageEntity { */ private Integer locked; + /** + * RFC-051 PR-7: soft-archive flag. {@code archived=1} hides the page from + * default list / search / related results without destroying it. Used to + * tuck away pages that are no longer relevant but whose history (citations, + * source-raw lineage) should stay queryable. + */ + private Integer archived; + @TableField(fill = FieldFill.INSERT) private LocalDateTime createTime; diff --git a/mateclaw-server/src/main/java/vip/mate/wiki/repository/WikiPageMapper.java b/mateclaw-server/src/main/java/vip/mate/wiki/repository/WikiPageMapper.java index 727454a1..333d1a70 100644 --- a/mateclaw-server/src/main/java/vip/mate/wiki/repository/WikiPageMapper.java +++ b/mateclaw-server/src/main/java/vip/mate/wiki/repository/WikiPageMapper.java @@ -22,9 +22,9 @@ public interface WikiPageMapper extends BaseMapper { * DB keyword search (H2 + MySQL compatible LIKE). * Does not SELECT content CLOB to avoid loading large blobs into Java heap. */ - @Select("SELECT id, kb_id, slug, title, summary, source_raw_ids, last_updated_by " + + @Select("SELECT id, kb_id, slug, title, summary, source_raw_ids, last_updated_by, page_type " + "FROM mate_wiki_page " + - "WHERE kb_id = #{kbId} AND deleted = 0 " + + "WHERE kb_id = #{kbId} AND deleted = 0 AND archived = 0 " + "AND (LOWER(title) LIKE #{pattern} OR LOWER(summary) LIKE #{pattern} " + " OR LOWER(content) LIKE #{pattern}) " + "ORDER BY title LIMIT 20") @@ -37,14 +37,14 @@ public interface WikiPageMapper extends BaseMapper { */ @Select("") + "AND deleted = 0 AND archived = 0") List selectBatchLite(@Param("ids") Collection ids); /** * List all pages as lightweight projections (no content). */ @Select("SELECT id, slug, title, summary, page_type AS pageType FROM mate_wiki_page " + - "WHERE kb_id = #{kbId} AND deleted = 0 ORDER BY update_time DESC") + "WHERE kb_id = #{kbId} AND deleted = 0 AND archived = 0 ORDER BY update_time DESC") List selectAllLite(@Param("kbId") Long kbId); /** @@ -59,7 +59,7 @@ public interface WikiPageMapper extends BaseMapper { * Phase 1 (fast): search only title + summary columns. */ @Select("SELECT id FROM mate_wiki_page " + - "WHERE kb_id = #{kbId} AND deleted = 0 " + + "WHERE kb_id = #{kbId} AND deleted = 0 AND archived = 0 " + "AND (LOWER(title) LIKE #{kw} OR LOWER(summary) LIKE #{kw}) " + "LIMIT #{limit}") List searchFastIds(@Param("kbId") Long kbId, @@ -70,7 +70,7 @@ public interface WikiPageMapper extends BaseMapper { * Phase 2 (slow): search full content, excluding already-found IDs. */ @Select("