Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

改进作业查询接口的模糊搜索 #139

Open
Lixuhuilll opened this issue Sep 29, 2023 · 1 comment
Open

改进作业查询接口的模糊搜索 #139

Lixuhuilll opened this issue Sep 29, 2023 · 1 comment

Comments

@Lixuhuilll
Copy link
Contributor

Lixuhuilll commented Sep 29, 2023

目前作业查询接口是通过 $regex 运算符实现模糊查询,此方法进行模糊查询目前存在部分问题:

  1. 用户有时会在不知情的情况下输入了一个合法正则,查询出不符合用户预期的内容
  2. 用户的输入可能会存在不合法正则,导致异常

除了正则本身的问题外,模糊查询还面临一个问题:关卡信息的模糊查询是从 stageId、关卡名、关卡类型、关卡编号中搜索,而 stageId 中可能正好包含了其他关卡的信息,例如搜索 7-10,则返回的关卡为 7-10 和 7-12,因为 7-12 的 stageId 为 main_07-10,或许考虑不搜索 stageId 或是降低 stageId 的优先级

@Lixuhuilll
Copy link
Contributor Author

第一点倒是可以让前端提醒下用户,当前是正则表达式。第二点可以直接用 java 现成的正则引擎提前校验,报错就是正则表达式写错了,告知用户。
也可以考虑放弃正则,使用文本索引配合 $text 运算符。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant