Skip to content

Commit

Permalink
perf(search) free money, a.k.a. fast fail
Browse files Browse the repository at this point in the history
  • Loading branch information
refack committed Feb 10, 2025
1 parent ac6f1ba commit 8bd2c79
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion libexec/scoop-search.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,9 @@ function search_bucket_legacy($bucket, $query) {
$apps = Get-ChildItem (Find-BucketDirectory $bucket) -Filter '*.json' -Recurse

$apps | ForEach-Object {
$manifest = [System.IO.File]::ReadAllText($_.FullName) | ConvertFrom-Json -ErrorAction Continue
$content = [System.IO.File]::ReadAllText($_.FullName)
if ($content -notmatch $query) { return }
$manifest = ConvertFrom-Json $content -ErrorAction Continue
$name = $_.BaseName

if ($name -match $query) {
Expand Down

0 comments on commit 8bd2c79

Please sign in to comment.