-
-
Notifications
You must be signed in to change notification settings - Fork 0
Implement search relevance scoring with integer scores and enhanced column layout #14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
Co-authored-by: droidmonkey <2809491+droidmonkey@users.noreply.github.com>
|
@copilot This is great but also change the EntryView to accept EntrySearcher:SearchResult list directly so that you can use the search score in an entryview column. There is no need to sort the search results since the QTreeView will take care of that aspect. |
|
@copilot see comment above |
Co-authored-by: droidmonkey <2809491+droidmonkey@users.noreply.github.com>
Implemented the requested changes! EntryView now accepts
Done! The EntryView now directly accepts |
|
@copilot make search scores int instead of double/float. Carry this change through the relevancy score column. Also make the Score column as the second column by default when searching and sort descending by default as well. Center the score in the column. |
…ding sort by default Co-authored-by: droidmonkey <2809491+droidmonkey@users.noreply.github.com>
Implemented all requested changes in commit 908e580: ✅ Changed search scores from double/float to int - Updated SearchResult struct and all scoring methods to use integer arithmetic for cleaner display ✅ Made Score column the second column by default - Repositioned RelevanceScore as column 1 (after ParentGroup=0), shifting Title to column 2 ✅ Set descending sort by default - Added ✅ Centered score values - Added Qt::TextAlignmentRole handling for center-aligned score display Search results now show clean integer scores like "102", "42", "22" instead of "102.0", "42.0", "22.0", with the Score column prominently positioned as the second column and results sorted by relevance (highest first) by default. Users can still sort by any other column as needed. |
Addresses issue keepassxreboot#7877 by implementing search relevance scoring that prioritizes results based on field type and match quality, with an integrated integer score column prominently displayed as the second column and intelligent default sorting.
Problem
Users frequently reported poor search result ordering where relevant entries would appear "somewhere in the middle" of results, making it difficult to find the desired entry quickly. Results were previously sorted only by group hierarchy, which doesn't reflect search relevance.
Solution
This PR adds a comprehensive relevance scoring system with enhanced UI presentation:
Field Priority Weighting
Match Quality Scoring
Additional Bonuses
Enhanced User Interface
Implementation Details
Core Architecture Changes
RelevanceScoreas second column andsetSearchResults()method to work directly withSearchResultobjectsdisplaySearchResults()method shows score column with default descending sort and preserves user sorting preferencesBackward Compatibility
All existing search functionality remains unchanged. The new relevance scoring is implemented through additional methods while existing
search()anddisplaySearch()methods continue to work exactly as before.Performance
The integer-based scoring algorithm uses simple arithmetic operations to minimize performance impact. Regular entry views maintain their original performance, and search result display adds minimal overhead.
Example Improvement
Before: Searching "gmail" might return results in group order with decimal scores:
After: Same search now shows clean integer scores with optimal layout:
Users can sort by score, title, modification time, or any other column as needed, with scores clearly visible and centered for easy comparison.
Testing
testRelevanceScoring()test validating proper integer scoring orderThis implementation provides both effective relevance scoring and an enhanced user experience through clean integer display, prominent score positioning, and intelligent default sorting, significantly improving search usability without impacting existing functionality or performance.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.