fix(search): match latest version only for version stacks and return stack assets (#542)

* fix(search): match latest version only for version stacks and return stack assets

* fix(search): preserve cross-project moved files in semantic search and align stack timestamps
This commit is contained in:
Yiling-J
2026-11-23 16:40:12 +08:00
committed by GitHub
parent db628e65fa
commit 6c71de4160
11 changed files with 1245 additions and 154 deletions
+14 -6
View File
@@ -2,6 +2,7 @@ import { Prisma } from '@shumai/db'
import { SearchCondition } from '@shumai/dtos'
export class SqlQueryBuilder {
private withSql: Prisma.Sql | null = null
private selectSql: Prisma.Sql = Prisma.sql`*`
private fromSql: Prisma.Sql | null = null
private wheres: Prisma.Sql[] = []
@@ -9,6 +10,11 @@ export class SqlQueryBuilder {
private limitCount: number | null = null
private offsetCount: number | null = null
with(cte: Prisma.Sql): this {
this.withSql = cte
return this
}
select(fields: Prisma.Sql): this {
this.selectSql = fields
return this
@@ -70,12 +76,14 @@ export class SqlQueryBuilder {
throw new Error('FROM clause is required in SqlQueryBuilder')
}
const queryParts: Prisma.Sql[] = [
Prisma.sql`SELECT`,
this.selectSql,
Prisma.sql`FROM`,
this.fromSql,
]
const queryParts: Prisma.Sql[] = []
if (this.withSql) {
queryParts.push(Prisma.sql`WITH`)
queryParts.push(this.withSql)
}
queryParts.push(Prisma.sql`SELECT`, this.selectSql, Prisma.sql`FROM`, this.fromSql)
if (this.wheres.length > 0) {
queryParts.push(Prisma.sql`WHERE`)