mirror of
https://github.com/ThearchyHelios/AgentLab.git
synced 2026-11-15 17:22:00 +00:00
PostgreSQL 上和 SQLite 一致的两处:知识库统计的 sum 转成整数(PostgreSQL 的 sum 交回 numeric,驱动给 Decimal);对象索引按注释搜索不分大小写(SQLite 的 LIKE 对 ASCII 本来就不分,PostgreSQL 分,改用 icontains)
This commit is contained in:
@@ -886,8 +886,9 @@ async def search_index(session: AsyncSession, row: Any, query: str, *, limit: in
|
||||
return [], 0
|
||||
key = name_key(text.rsplit(".", 1)[-1])
|
||||
filt = (*_scope_filter(row.id, index_schema(row)), SourceObject.removed_at.is_(None),
|
||||
# 名字比的是 name_key(ASCII 已转小写);注释要不分大小写:SQLite 的 LIKE 本来就不分(ASCII),PostgreSQL 分
|
||||
or_(SourceObject.name_key.contains(key, autoescape=True),
|
||||
SourceObject.comment.contains(text, autoescape=True)))
|
||||
SourceObject.comment.icontains(text, autoescape=True)))
|
||||
total = int((await session.execute(select(func.count()).select_from(SourceObject).where(*filt))).scalar() or 0)
|
||||
rows = (await session.execute(
|
||||
select(SourceObject.name, SourceObject.name_key, SourceObject.kind, SourceObject.comment,
|
||||
|
||||
Reference in New Issue
Block a user