File tree Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -59,6 +59,13 @@ extension Unidoc.PackagesCrawledQuery:Mongo.PipelineQuery
59
59
$0 [ . foreignField] = Unidoc . PackageMetadata [ . repo] / Unidoc. PackageRepo [ . created]
60
60
$0 [ . pipeline] = . init
61
61
{
62
+ /// This improves query performance enormously, as it gets MongoDB to use the
63
+ /// partial index. But why?? The `localField` is always non-null!
64
+ $0 [ . match] = . init
65
+ {
66
+ $0 [ Unidoc . PackageMetadata [ . repo] ] = . init { $0 [ . exists] = true }
67
+ }
68
+
62
69
$0 [ . count] = count
63
70
}
64
71
$0 [ . as] = Date [ . repos]
Original file line number Diff line number Diff line change @@ -63,8 +63,8 @@ extension Unidoc.RealmQuery:Unidoc.AliasingQuery
63
63
}
64
64
}
65
65
66
- // This *should* be able to use the partial index even without `$exists` guards,
67
- // as `_id` is always present .
66
+ // It’s not clear to me how this is able to use the partial index even without
67
+ // `$exists` guards, but somehow it does .
68
68
pipeline [ . lookup] = . init
69
69
{
70
70
$0 [ . from] = UnidocDatabase . Packages. name
You can’t perform that action at this time.
0 commit comments