Skip to content

filters 参数格式与查询引擎不兼容导致筛选无效 #799

Description

@hotlong

问题描述

列表筛选时,浏览器请求的 filters 参数为 JSON 数组 AST 格式(如:["and", ["priority", "=", "high"], ["status", "=", "active"]]),服务端接收到参数后,并未按照 spec 规范转换为正确的 FilterCondition(对象)格式,导致服务端未对数据进行筛选,返回了全部记录。

复现步骤

  1. 在 ObjectUI 列表页面进行多条件筛选(如按照 priority=high 且 status=active)。
  2. 浏览器发出的请求如:
GET /api/v1/data/contact?top=100&sort=name&filters=["and",["priority","=","high"],["status","=","active"]]
  1. 服务端收到后,最终在 findData 处理时,仅做了 JSON.parse,但未将 AST 数组格式转换为 FilterCondition 对象格式,导致 filter 永远无法生效。

期望行为

  • 服务端能够识别 filters 为 AST (数组)格式时,自动转换为符合 FilterCondition 对象结构,传给底层查询引擎。
  • 筛选条件能准确生效,返回预期的结果集。

建议修复点

  • 建议在 packages/objectql/src/protocol.tsfindData 方法里处理 filters,如果解析后为数组 AST,自动转换为 { $and: [...] } 结构传递。
  • 并在 Dispatcher 层需保证参数在整个链路中以规范形式传递(不要丢失/多包一层)。

参考


如需英文描述请告知。

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bugSomething isn't working

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions