feat: add precise content preview with offset support#343
Conversation
1. Implement PreviewOptions and PreviewResult classes for precise content extraction 2. Add fetchPreview API to ContentRetriever for offset-based content reading 3. Create previewSnippet utility function in ContentHighlighter 4. Update CLI client to support offset and precise preview commands 5. Add comprehensive unit tests for all new functionality 6. Implement private classes with value semantics using QSharedDataPointer This feature enables applications to: - Read content from specific offsets without keyword searching - Search content starting from an offset position - Get exact content snippets without formatting or simplification - See keyword match positions in the source text Log: Added precise content preview with offset parameter support Influence: 1. Test fetchPreview with various offset values (valid and invalid) 2. Verify keyword searching starting from different offsets 3. Test edge cases (empty content, negative offsets, offsets beyond content length) 4. Verify output formatting and keyword position reporting 5. Test concurrent access to the preview functionality 6. Check CLI interface with new offset parameter feat: 添加带偏移量的精确内容预览功能 1. 实现 PreviewOptions 和 PreviewResult 类用于精确内容提取 2. 在 ContentRetriever 中添加 fetchPreview API 用于基于偏移量的内容读取 3. 在 ContentHighlighter 中创建 previewSnippet 工具函数 4. 更新命令行客户端以支持偏移量和精确预览命令 5. 添加全面的单元测试覆盖新功能 6. 使用 QSharedDataPointer 实现具有值语义的私有类 该功能使应用程序能够: - 从特定偏移量读取内容而无需关键字搜索 - 从偏移位置开始搜索内容 - 获取精确内容片段而无需格式化或简化 - 查看关键字在源文本中的匹配位置 Log: 新增带偏移量参数的内容精确预览功能 Influence: 1. 测试不同偏移量下的 fetchPreview 功能(有效和无效值) 2. 验证从不同偏移位置开始的关键字搜索 3. 测试边界情况(空内容、负偏移量、超出内容长度的偏移量) 4. 验证输出格式和关键字位置报告 5. 测试预览功能的并发访问 6. 检查包含新偏移量参数的命令行接口
There was a problem hiding this comment.
Sorry @Johnson-zs, you have reached your weekly rate limit of 500000 diff characters.
Please try again later or upgrade to continue using Sourcery
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: Johnson-zs 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 |
1. Added comprehensive documentation for dfm-searcher command line tool 2. Covers all major features including filename search, content search, OCR search, semantic search and preview functionality 3. Includes detailed examples for all command options and use cases 4. Provides JSON output structure documentation 5. Contains troubleshooting FAQ section This documentation serves as a complete reference guide for users and developers working with dfm-searcher tool. It explains both basic and advanced usage patterns with clear examples. The document is organized into three main parts covering search functionality, preview operations, and reference sections. Log: Added official documentation for dfm-searcher command line tool Influence: 1. Verify all example commands work as described 2. Test documentation coverage against actual tool functionality 3. Check formatting and accuracy of JSON output examples 4. Validate troubleshooting advice against real issues docs: 添加dfm-searcher使用指南文档 1. 添加了dfm-searcher命令行工具的完整文档 2. 涵盖包括文件名搜索、内容搜索、OCR搜索、语义搜索和预览功能等主要特性 3. 提供所有命令选项和使用场景的详细示例 4. 包含JSON输出结构文档 5. 提供故障排除FAQ部分 本文档作为dfm-searcher工具用户和开发者的完整参考指南。通过清晰示例解释基 础和高级使用模式。文档分为三大部分,涵盖搜索功能、预览操作和参考章节。 Log: 新增dfm-searcher命令行工具的官方文档 Influence: 1. 验证所有示例命令是否按描述工作 2. 测试文档覆盖范围与工具实际功能的匹配度 3. 检查JSON输出示例的格式和准确性 4. 验证故障排除建议是否解决实际问题
deepin pr auto review★ 总体评分:100分■ 【总体评价】
■ 【详细分析】
■ 【改进建议代码示例】 // 代码质量优秀,无需修复,以下为可选的增强建议:
// 在previewSnippet中可增加对offset超过content.length()的显式处理,虽然QString::mid会安全返回空字符串,但显式检查可提升可读性
QString previewSnippet(const QString &content, int offset, int maxLength,
const QString &keyword, int *keywordOffset)
{
if (keywordOffset) {
*keywordOffset = -1;
}
if (content.isEmpty() || maxLength <= 0 || offset < 0 || offset >= content.length()) {
return {};
}
if (keyword.isEmpty()) {
return content.mid(offset, maxLength);
}
int pos = content.indexOf(keyword, offset, Qt::CaseInsensitive);
if (pos == -1) {
return {};
}
if (keywordOffset) {
*keywordOffset = pos;
}
return content.mid(pos, maxLength);
} |
|
/forcemerge |
|
This pr force merged! (status: blocked) |
content extraction
reading
QSharedDataPointer
This feature enables applications to:
Log: Added precise content preview with offset parameter support
Influence:
content length)
feat: 添加带偏移量的精确内容预览功能
该功能使应用程序能够:
Log: 新增带偏移量参数的内容精确预览功能
Influence: