@@ -162,7 +162,7 @@ void FuzzySearchResult::score_token_match(FuzzyTokenMatch &p_match, bool p_case_
162162 substring_score *= 2 ;
163163 }
164164 // Score matches on a word boundary higher than matches within a word
165- if (_is_word_boundary (target. string , substring.x - 1 ) || _is_word_boundary (target. string , substring.x + substring.y )) {
165+ if (_is_word_boundary (target, substring.x - 1 ) || _is_word_boundary (target, substring.x + substring.y )) {
166166 substring_score += 4 ;
167167 }
168168 // Score exact query matches higher than non-compact subsequence matches
@@ -245,10 +245,10 @@ void FuzzySearch::sort_and_filter(Vector<FuzzySearchResult> &p_results) const {
245245 bool operator ()(const FuzzySearchResult &p_lhs, const FuzzySearchResult &p_rhs) const {
246246 // Sort on (score, length, alphanumeric) to ensure consistent ordering.
247247 if (p_lhs.score == p_rhs.score ) {
248- if (p_lhs.target .string . length () == p_rhs.target . string .length ()) {
249- return p_lhs.target . string < p_rhs.target . string ;
248+ if (p_lhs.target .length () == p_rhs.target .length ()) {
249+ return p_lhs.target < p_rhs.target ;
250250 }
251- return p_lhs.target .string . length () < p_rhs.target . string .length ();
251+ return p_lhs.target .length () < p_rhs.target .length ();
252252 }
253253 return p_lhs.score > p_rhs.score ;
254254 }
@@ -293,16 +293,11 @@ void FuzzySearch::set_query(const String &p_query, bool p_case_sensitive) {
293293}
294294
295295bool FuzzySearch::search (const String &p_target, FuzzySearchResult &p_result) const {
296- return search ({ p_target, nullptr }, p_result);
297- }
298-
299- bool FuzzySearch::search (const FuzzySearchTarget &p_target, FuzzySearchResult &p_result) const {
300296 p_result.target = p_target;
301- const String &target_text = p_target.string ;
302- p_result.dir_index = target_text.rfind_char (' /' );
297+ p_result.dir_index = p_target.rfind_char (' /' );
303298 p_result.miss_budget = max_misses;
304299
305- String adjusted_target = case_sensitive ? target_text : target_text .to_lower ();
300+ String adjusted_target = case_sensitive ? p_target : p_target .to_lower ();
306301
307302 // For each token, eagerly generate subsequences starting from index 0 and keep the best scoring one
308303 // which does not conflict with prior token matches. This is not ensured to find the highest scoring
@@ -324,7 +319,7 @@ bool FuzzySearch::search(const FuzzySearchTarget &p_target, FuzzySearchResult &p
324319 }
325320 }
326321 if (p_result.can_add_token_match (match)) {
327- p_result.score_token_match (match, match.is_case_insensitive (target_text , adjusted_target));
322+ p_result.score_token_match (match, match.is_case_insensitive (p_target , adjusted_target));
328323 if (best_match.token_idx == -1 || best_match.score < match.score ) {
329324 best_match = match;
330325 }
@@ -348,16 +343,6 @@ bool FuzzySearch::search(const FuzzySearchTarget &p_target, FuzzySearchResult &p
348343}
349344
350345void FuzzySearch::search_all (const PackedStringArray &p_targets, Vector<FuzzySearchResult> &p_results) const {
351- Vector<FuzzySearchTarget> targets;
352-
353- for (const String &target : p_targets) {
354- targets.push_back ({ target, nullptr });
355- }
356-
357- search_all (targets, p_results);
358- }
359-
360- void FuzzySearch::search_all (const Vector<FuzzySearchTarget> &p_targets, Vector<FuzzySearchResult> &p_results) const {
361346 p_results.clear ();
362347
363348 for (int i = 0 ; i < p_targets.size (); i++) {
0 commit comments