File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -155,25 +155,16 @@ function createResultSorter(keys, keyWeights = {}) {
155155 for ( let i = 0 ; i < keys . length ; i ++ ) {
156156 const key = keys [ i ] ;
157157
158- const tokenComparison = compareTokens (
159- resultA . tokens [ key ] ,
160- resultB . tokens [ key ]
161- ) ;
162-
163- if ( tokenComparison !== 0 ) {
164- comparison += tokenComparison * ( keyWeights [ key ] ?? Math . pow ( 0.5 , i ) ) ;
165- continue ;
166- }
167-
168- const stringComparison = compareStrings (
158+ const resultComparison = compareTokens (
159+ resultA . tokens [ key ] ,
160+ resultB . tokens [ key ]
161+ ) || compareStrings (
169162 resultA . item [ key ] ,
170163 resultB . item [ key ]
171164 ) ;
172165
173- if ( stringComparison !== 0 ) {
174- comparison += stringComparison * ( keyWeights [ key ] ?? Math . pow ( 0.5 , i ) ) ;
175- continue ;
176- }
166+ comparison += resultComparison * ( keyWeights [ key ] ?? Math . pow ( 0.5 , i ) ) ;
167+
177168 }
178169
179170 return comparison ;
You can’t perform that action at this time.
0 commit comments