master#304
Conversation
Johnson-zs
commented
Jun 17, 2026
- feat: add configurable keyword positioning in search results
- chore: bump version to 1.3.59
1. Added positioningMaxLength parameter to HighlightOptions structure to allow configuration of keyword positioning window size 2. Modified customHighlight function to accept and use this parameter for better keyword positioning in search results 3. Enforced minimum window size of 30 characters for proper keyword visibility 4. Updated all function calls to pass the new parameter 5. Improved documentation for the customHighlight function parameters Log: Added configurable keyword positioning window for better search result snippets Influence: 1. Test search results with different positioningMaxLength values (below 30 and above 30) 2. Verify keyword visibility and snippet positioning in results 3. Check HTML highlighting still works when enabled 4. Test with both short and long content samples 5. Verify behavior with empty content or keyword lists feat: 添加可配置的关键词定位功能 1. 在HighlightOptions结构中添加positioningMaxLength参数,用于配置关键词 定位窗口大小 2. 修改customHighlight函数以接受并使用此参数,改进搜索结果中的关键词定位 3. 强制30个字符的最小窗口尺寸以确保关键词可见性 4. 更新所有函数调用以传递新参数 5. 改进了customHighlight函数的参数文档 Log: 新增可配置关键词定位窗口,改进搜索结果片段显示 Influence: 1. 使用不同的positioningMaxLength值测试搜索结果(小于30和大于30) 2. 验证结果中的关键词可见性和片段定位 3. 检查启用HTML高亮时是否仍正常工作 4. 测试短内容和长内容样本 5. 验证空内容或关键词列表时的行为 Fixes: #365083
1.3.59 Log:
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 |
|
TAG Bot TAG: 1.3.59 |
deepin pr auto review★ 总体评分:100分■ 【总体评价】
■ 【详细分析】
■ 【改进建议代码示例】 // 当前代码已足够优秀,无需额外修改,此处展示保持当前良好实践的代码结构
struct HighlightOptions
{
int maxPreviewLength = 200; ///< Maximum snippet length in characters
int positioningMaxLength = 30; ///< Keyword positioning window size (min 30)
bool enableHtml = false; ///< Wrap matched keywords with <b> tags
};
QString customHighlight(const QStringList &keywords, const QString &content, int maxLength, bool enableHtml, int positioningMaxLength)
{
if (content.isEmpty() || keywords.isEmpty()) {
return QString();
}
// Enforce minimum of 30 for the positioning window
const int effectivePositioningLength = qMax(30, positioningMaxLength);
int optimalStart = findOptimalStartPosition(content, match.position, effectivePositioningLength);
// ... 后续使用 effectivePositioningLength 进行安全计算 ...
} |
|
/forcemerge |
|
This pr force merged! (status: blocked) |
|
TAG Bot ✅ Tag created successfully 📋 Tag Details
|