click subpath

This commit is contained in:
2025-04-10 18:07:10 +08:00
parent 48d5bdafa4
commit b8cd3716c4
5 changed files with 68 additions and 10 deletions

View File

@@ -60,9 +60,24 @@ export function buildFilter(params: Partial<EventsQueryParams>): string {
// 添加子路径过滤条件
if (params.subpath) {
console.log('Adding subpath filter:', params.subpath);
// 使用 url 字段和字符串函数替代不存在的 path 字段
filters.push(`positionCaseInsensitive(url, '/${params.subpath}') > 0`);
console.log('====== SUBPATH DEBUG ======');
console.log('Raw subpath param:', params.subpath);
console.log('Subpath type:', typeof params.subpath);
console.log('Subpath length:', params.subpath.length);
// 确保子路径没有前导斜杠,避免双斜杠问题
const cleanSubpath = params.subpath.startsWith('/')
? params.subpath.substring(1)
: params.subpath;
console.log('Cleaned subpath:', cleanSubpath);
// 在event_attributes JSON的full_url字段中查找subpath
const condition = `JSONExtractString(event_attributes, 'full_url') LIKE '%${cleanSubpath}%'`;
console.log('Final SQL condition:', condition);
console.log('==========================');
filters.push(condition);
}
// 添加团队ID过滤条件