Commit 3d58732
perf(adapter): skip op_search relevance projection when caller supplied order, fold search detection into find partition
The find pipeline previously walked queries twice: once for the partition
(vector / adapter-filter / other) and again via `extractSearchQueries` to
project a `_relevance` SELECT and ORDER BY. With FULLTEXT MATCH that
means the relevance MATCH is compiled and evaluated a second time.
Pick up search queries in the existing single-pass partition loop and
skip the relevance projection entirely when the caller already supplied
an explicit order — the Documents trait auto-appends `$sequence` as a
tiebreaker, so anything richer than a lone `$sequence` is caller-driven
and would be silently overridden by relevance order otherwise.
`extractSearchQueries` is kept as a protected method for adapter overrides
but is no longer called from `find`.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 11b444d commit 3d58732
1 file changed
Lines changed: 24 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1182 | 1182 | | |
1183 | 1183 | | |
1184 | 1184 | | |
1185 | | - | |
| 1185 | + | |
| 1186 | + | |
| 1187 | + | |
1186 | 1188 | | |
1187 | 1189 | | |
1188 | 1190 | | |
1189 | 1191 | | |
1190 | 1192 | | |
1191 | 1193 | | |
1192 | 1194 | | |
| 1195 | + | |
1193 | 1196 | | |
1194 | 1197 | | |
1195 | 1198 | | |
| |||
1210 | 1213 | | |
1211 | 1214 | | |
1212 | 1215 | | |
| 1216 | + | |
| 1217 | + | |
| 1218 | + | |
| 1219 | + | |
1213 | 1220 | | |
1214 | 1221 | | |
1215 | 1222 | | |
| |||
1423 | 1430 | | |
1424 | 1431 | | |
1425 | 1432 | | |
1426 | | - | |
1427 | | - | |
1428 | | - | |
| 1433 | + | |
| 1434 | + | |
| 1435 | + | |
| 1436 | + | |
| 1437 | + | |
| 1438 | + | |
| 1439 | + | |
| 1440 | + | |
| 1441 | + | |
| 1442 | + | |
| 1443 | + | |
| 1444 | + | |
| 1445 | + | |
| 1446 | + | |
| 1447 | + | |
| 1448 | + | |
1429 | 1449 | | |
1430 | 1450 | | |
1431 | 1451 | | |
| |||
0 commit comments