@@ -54,9 +54,9 @@ export class SortingManager {
54
54
55
55
const filterIssues = ( ) => {
56
56
try {
57
- const filterText = textBox . value ;
57
+ const filterText = textBox . value . toLowerCase ( ) ;
58
58
const issues = Array . from ( issuesContainer . children ) as HTMLDivElement [ ] ;
59
-
59
+
60
60
// Reset any active sort buttons when searching
61
61
if ( filterText ) {
62
62
this . _resetSortButtons ( ) ;
@@ -74,25 +74,27 @@ export class SortingManager {
74
74
issues . forEach ( ( issue ) => {
75
75
const issueId = issue . children [ 0 ] . getAttribute ( "data-issue-id" ) ;
76
76
if ( ! issueId ) return ;
77
-
77
+
78
78
const result = searchResults . get ( parseInt ( issueId ) ) ;
79
79
if ( ! result ) return ;
80
-
80
+
81
81
issue . classList . add ( "active" ) ;
82
82
issue . style . display = result . visible ? "block" : "none" ;
83
-
83
+
84
84
if ( result . score !== undefined ) {
85
85
issue . setAttribute ( "data-relevance-score" , result . score . toFixed ( 3 ) ) ;
86
86
}
87
87
} ) ;
88
88
89
89
// If there's a search term, sort by relevance
90
90
if ( filterText ) {
91
- issues . sort ( ( a , b ) => {
92
- const scoreA = parseFloat ( a . getAttribute ( "data-relevance-score" ) || "0" ) ;
93
- const scoreB = parseFloat ( b . getAttribute ( "data-relevance-score" ) || "0" ) ;
94
- return scoreB - scoreA ; // Sort in descending order of relevance score
95
- } ) . forEach ( ( issue ) => issuesContainer . appendChild ( issue ) ) ;
91
+ issues
92
+ . sort ( ( a , b ) => {
93
+ const scoreA = parseFloat ( a . getAttribute ( "data-relevance-score" ) || "0" ) ;
94
+ const scoreB = parseFloat ( b . getAttribute ( "data-relevance-score" ) || "0" ) ;
95
+ return scoreB - scoreA ; // Sort in descending order of relevance score
96
+ } )
97
+ . forEach ( ( issue ) => issuesContainer . appendChild ( issue ) ) ;
96
98
}
97
99
} catch ( error ) {
98
100
return renderErrorInModal ( error as Error ) ;
0 commit comments