搜索适配 - #496
Closed
dengzhongyuan365-dev wants to merge 18 commits into
Closed
搜索适配#496dengzhongyuan365-dev wants to merge 18 commits into
dengzhongyuan365-dev wants to merge 18 commits into
Conversation
Hide the Tiptap editor when search returns no results. Move the new note entry to the note list header. 搜索无结果时隐藏Tiptap编辑器,避免编辑区域布局异常。 将新建笔记入口移动到笔记列表标题栏。 Log: 修复搜索布局并调整新建笔记入口 PMS: TASK-393985 Influence: 搜索无结果时工具栏不再出现在页面底部, 新建笔记入口位置和显示状态更加稳定。
Delay migration start until the upgrade view can render first. 延迟启动迁移流程,确保升级界面可以先完成首次渲染。 Move the upgrade overlay to the app window and keep the titlebar visible. 将升级覆盖层移到应用窗口层级,并保留标题栏可见。 Log: 修复升级迁移界面显示时机与覆盖范围 PMS: TASK-393985 Influence: 迁移少量或空数据时也能看到升级界面,且迁移期间标题栏保持可见。
Prepare note data APIs for read-only search document extraction. 为只读搜索文档抽取准备 const 安全的数据访问接口。 Log: 调整搜索抽取所需只读接口 PMS: TASK-393985 Influence: 搜索模块可以在不修改笔记数据的前提下读取结构化内容,降低索引构建时的副作用风险。
Introduce searchable document segments and normalized text matching. 新增可搜索文档片段模型和文本归一化匹配能力。 Log: 新增搜索文档模型和文本归一化 PMS: TASK-393985 Influence: 搜索逻辑具备统一的数据表示,后续可同时覆盖标题、正文、语音标题、语音转写和图片描述等内容。
Extract legacy and Tiptap note content into searchable segments. 将旧格式和 Tiptap 笔记内容抽取为统一搜索片段。 Log: 新增笔记搜索文档抽取器 PMS: TASK-393985 Influence: 搜索可识别 Tiptap ProseMirror 正文、语音块标题、语音转写文本以及图片描述,同时保持旧格式兼容。
Add n-gram indexed search with scoring and result snippets. 新增 n-gram 索引搜索,支持评分和结果片段。 Log: 新增笔记搜索索引服务 PMS: TASK-393985 Influence: 搜索从逐条内容扫描升级为索引候选加最终校验,提升搜索性能并为结果排序和片段展示提供基础。
Build search sources and add architecture-level search tests. 接入搜索源码构建,并添加搜索架构层单测。 Log: 添加搜索架构测试 PMS: TASK-393985 Influence: 覆盖搜索抽取、归一化、索引匹配和 Tiptap 内容兼容,降低后续迁移回归风险。
Route note-level search through the shared document extractor. 将单笔记搜索改为复用统一文档抽取器。 Log: 统一单笔记搜索实现 PMS: TASK-393985 Influence: 旧的 VNoteItem::search 与新搜索索引使用一致的抽取逻辑,避免 Summernote 和 Tiptap 搜索结果不一致。
Synchronize native search query changes to the Tiptap runtime. 将宿主搜索词同步到 Tiptap 编辑器运行态。 Log: 添加 Tiptap 搜索状态桥接 PMS: TASK-393985 Influence: Native 搜索框状态可以实时驱动 Tiptap 页面高亮,清空搜索时也能恢复编辑器原始显示。
Use indexed search for result loading and keep indexes fresh. 使用索引搜索加载结果,并在笔记变更时维护索引。 Log: 接入笔记搜索业务流程 PMS: TASK-393985 Influence: 搜索结果现在包含标题高亮、匹配字段、片段和评分;保存、重命名、删除及迁移后会同步更新搜索索引。
Render runtime search highlights without changing document content. 在不修改文档内容的前提下渲染运行态搜索高亮。 Log: 添加 Tiptap 搜索高亮渲染 PMS: TASK-393985 Influence: Tiptap 正文和语音块转写文本可显示搜索命中高亮,不会进入保存内容或 undo/redo 历史。
Add tests for Tiptap search state and highlight rendering. 添加 Tiptap 搜索状态和高亮渲染测试。 Log: 添加 Tiptap 搜索高亮测试 PMS: TASK-393985 Influence: 覆盖搜索命中、清空搜索和运行态高亮行为,保障迁移过程中的前端搜索体验稳定。
Add read-only transcript selection and copy helpers in Tiptap. 添加只读语音转写文本选择和复制辅助逻辑。 Log: 修复转写文本前端选择复制 PMS: TASK-393985 Influence: 语音转写文本可以像普通文本一样选择和复制,同时保持语音块结构只读,避免破坏 ProseMirror 文档。
Allow Tiptap read-only DOM text to write to the system clipboard. 允许 Tiptap 只读 DOM 文本写入系统剪贴板。 Log: 添加转写文本剪贴板桥接 PMS: TASK-393985 Influence: 语音转写复制不再完全依赖 WebEngine 原生 Copy,提升 Ctrl+C 和右键复制在 QtWebEngine 下的稳定性。
Route shortcut and context-menu copy through transcript-aware paths. 将快捷键和右键复制路由到转写文本感知通道。 Log: 修复转写文本快捷键和右键复制 PMS: TASK-393985 Influence: Ctrl+C 和右键菜单复制语音转写文本均可正常写入剪贴板,右键无选区时也能复制当前转写内容。
Rebuild bundled editor assets after search and copy updates. 在搜索和复制修复后重建编辑器打包产物。 Log: 重建 Tiptap 编辑器产物 PMS: TASK-393985 Influence: 桌面端内置资源包含最新搜索高亮和语音转写复制逻辑。
Rename the migration upgrade view QML type to avoid runtime conflicts. 重命名迁移升级页 QML 类型,避免运行时解析到错误组件。 Log: 修复语音记事本 AT 启动后找不到初始记事本的问题 Influence: 仅影响迁移升级覆盖层的 QML 类型名,普通启动和 AT fixture 加载已验证。
Clear stale QML disk cache in AT setup and disable QML disk cache for the launched app. 在AT启动脚本中清理旧QML磁盘缓存,并禁用本次应用进程的QML缓存。 Log: 修复线上机器命中旧QML缓存导致应用未启动的问题 Influence: 仅影响语音记事本AT启动前的本应用缓存清理,不改变业务逻辑。
There was a problem hiding this comment.
Sorry @dengzhongyuan365-dev, your pull request is larger than the review limit of 150,000 diff characters
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: dengzhongyuan365-dev The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
deepin pr auto review🤖 AI 代码审查报告📊 总体评价
📋 变更概要本次PR实现了 deepin-voice-note 的搜索功能全面适配,主要包含:
🔍 详细分析1. 语法逻辑 ✅ (22/25分)评价: 语法正确,逻辑清晰 ✅ 通过 潜在问题:
亮点:
2. 代码质量 ✅ (22/25分)评价: 代码结构清晰,注释完整 ✅ 通过 潜在问题:
亮点:
3. 代码性能 ✅ (17/20分)评价: 算法复杂度合理 ✅ 通过 潜在问题:
亮点:
4. 代码安全 ✅ (28/30分)评价: 存在0个安全漏洞 ✅ 通过
漏洞对比统计:新增漏洞 0 个,减少漏洞 0 个,持平 0 个 安全分析: 安全设计良好,未发现安全漏洞。具体安全检查结果如下:
防御性编程建议:
💡 改进建议代码示例// 建议1: WebEngineView.qml 中使用常量替代魔法数字
// 在文件顶部或全局定义:
// readonly property int WebAction_Copy: 5
// readonly property int WebAction_Undo: 7
// readonly property int WebAction_Redo: 8
// 建议2: SearchIndexManager 避免每次搜索全量遍历
// 可在 NoteSearchService 中维护脏标记,仅在笔记变更时刷新索引:
class NoteSearchService : public QObject {
// ...
private:
bool m_indexDirty = true;
void markDirty() { m_indexDirty = true; }
};
QList<SearchResult> NoteSearchService::search(VNOTE_ALL_NOTES_MAP *noteAll, const QString &query)
{
if (m_indexDirty) {
refreshIndex(noteAll);
m_indexDirty = false;
}
return m_index.search(query);
}
// 建议3: fingerprintForNote 使用长度前缀编码防止分隔符碰撞
QString SearchIndexManager::fingerprintForNote(const VNoteItem *note)
{
// 使用 JSON 序列化或长度前缀编码替代简单分隔符
QJsonObject obj;
obj["id"] = note->noteId;
obj["folder"] = static_cast<int>(note->folderId);
obj["title"] = note->noteTitle;
obj["html"] = note->htmlCode;
obj["meta"] = note->metaDataConstRef().toString();
return QJsonDocument(obj).toJson(QJsonDocument::Compact);
}本报告由 AI 代码审查工具自动生成 | 扫描时间: 2026-08-29 14:30:00 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Introduce searchable document segments and normalized text matching.
新增可搜索文档片段模型和文本归一化匹配能力。
Log: 新增搜索文档模型和文本归一化
PMS: TASK-393985
Influence: 搜索逻辑具备统一的数据表示,后续可同时覆盖标题、正文、语音标题、语音转写和图片描述等内容。