anshdadhich commited on
Commit
4a4acc1
·
verified ·
1 Parent(s): eeb467d

Upload FastSeekWpf/Core/SearchEngine.cs

Browse files
Files changed (1) hide show
  1. FastSeekWpf/Core/SearchEngine.cs +4 -3
FastSeekWpf/Core/SearchEngine.cs CHANGED
@@ -1,6 +1,7 @@
1
  using System;
2
  using System.Collections.Generic;
3
  using System.IO;
 
4
  using System.Text;
5
 
6
  namespace FastSeekWpf.Core;
@@ -188,7 +189,7 @@ public static class SearchEngine
188
  if (dotIdx >= 0)
189
  {
190
  string ext = nameLower[(dotIdx + 1)..];
191
- if (AppExtensions.Contains(ext) && ContainsAny(fullPathLower, AppPathMarkers))
192
  rank = 0;
193
  }
194
  }
@@ -271,8 +272,8 @@ public static class SearchEngine
271
  private static string BuildPathFast(IndexStore store, ulong fileRef, StringBuilder sb)
272
  {
273
  sb.Clear();
274
- // Stackalloc for components
275
- Span<string> components = stackalloc string[64];
276
  int compCount = 0;
277
  ulong current = fileRef;
278
 
 
1
  using System;
2
  using System.Collections.Generic;
3
  using System.IO;
4
+ using System.Linq;
5
  using System.Text;
6
 
7
  namespace FastSeekWpf.Core;
 
189
  if (dotIdx >= 0)
190
  {
191
  string ext = nameLower[(dotIdx + 1)..];
192
+ if (Array.IndexOf(AppExtensions, ext) >= 0 && ContainsAny(fullPathLower, AppPathMarkers))
193
  rank = 0;
194
  }
195
  }
 
272
  private static string BuildPathFast(IndexStore store, ulong fileRef, StringBuilder sb)
273
  {
274
  sb.Clear();
275
+ // string is a managed type, can't stackalloc it. Use small heap array.
276
+ string[] components = new string[64];
277
  int compCount = 0;
278
  ulong current = fileRef;
279