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

The search fails in REGEXP/SQL with order by relevance #7861

Closed
3 tasks done
Zuoqiu-Yingyi opened this issue Apr 2, 2023 · 3 comments
Closed
3 tasks done

The search fails in REGEXP/SQL with order by relevance #7861

Zuoqiu-Yingyi opened this issue Apr 2, 2023 · 3 comments
Assignees
Labels
Milestone

Comments

@Zuoqiu-Yingyi
Copy link
Contributor

Zuoqiu-Yingyi commented Apr 2, 2023

正则表达式模式下搜索失效

Is there an existing issue for this?

  • I have searched the existing issues

Can the issue be reproduced with the default theme (daylight/midnight)?

  • I was able to reproduce the issue with the default theme

Could the issue be due to extensions?

  • I've ruled out the possibility that the extension is causing the problem.

Describe the problem

使用正则表达式模式进行搜索时无搜索结果, API /api/search/fullTextSearchBlock 响应体 data.blocks 字段值为空数组, data.matchedRootCountdata.matchedBlockCount 字段值不为 0
No search results when searching using regular expression mode, API /api/search/fullTextSearchBlock response body data.blocks field value is an empty array, data.matchedRootCount and data.matchedBlockCount field values are not '0'

Expected result

API /api/search/fullTextSearchBlock 响应体 data.blocks 字段值为正常的查询结果
API /api/search/fullTextSearchBlock response body data.blocks field value is normal query results

Screenshot or screen recording presentation

No response

Version environment

- Version: 2.8.3-dev1
- Operating System: 
- Browser (if used):

Log file

无有效信息输出
No valid information output

More information

No response

@88250 88250 changed the title 正则表达式模式下搜索失效 | The search fails in regular expression mode The search fails in regular expression mode Apr 2, 2023
@88250
Copy link
Member

88250 commented Apr 2, 2023

I've tested fine here:

image

Please give the regular expression used for testing and the data of the content block to be searched, thank you.

@Zuoqiu-Yingyi
Copy link
Contributor Author

Please give the regular expression used for testing and the data of the content block to be searched, thank you.

排序方案使用 按相关度降序/升序
The sorting scheme uses Relevance DESC/ASC

请求体 | Request body

{
    "query": "内容块.*\\d+",
    "method": 3,
    "types": {
        "blockquote": false,
        "codeBlock": true,
        "document": true,
        "embedBlock": false,
        "heading": true,
        "htmlBlock": true,
        "list": false,
        "listItem": true,
        "mathBlock": true,
        "paragraph": true,
        "superBlock": false,
        "table": true
    },
    "paths": [],
    "groupBy": 1,
    "orderBy": 7
}

@88250 88250 self-assigned this Apr 3, 2023
@88250 88250 changed the title The search fails in regular expression mode The search fails in regular expression with order by Relevance Apr 3, 2023
@88250 88250 added the Bug label Apr 3, 2023
@88250 88250 added this to the 2.8.3 milestone Apr 3, 2023
@88250 88250 changed the title The search fails in regular expression with order by Relevance The search fails in regular expression with order by relevance Apr 3, 2023
@88250
Copy link
Member

88250 commented Apr 3, 2023

已经确认问题,同时也发现另一个问题,即相关度排序是通过 FTS 查询语法实现的(排序字段是 rank),也就是说正则表达式和 SQL 搜索实际上不能使用 FTS 相关度排序,下个版本会将该情况下强制使用 sort 字段和内置的相关度算法进行排序。

The problem has been confirmed, and another problem has been found, that is, the correlation ranking is implemented through the FTS query syntax (the sorting field is rank), which means that regular expressions and SQL searches cannot actually use relevance ranking provided by FTS, the next version will force sorting using the sort field and built-in relevance algorithm in this case.

@88250 88250 changed the title The search fails in regular expression with order by relevance The search fails in regular expression/SQL with order by relevance Apr 3, 2023
@88250 88250 changed the title The search fails in regular expression/SQL with order by relevance The search fails in REGEXP/SQL with order by relevance Apr 3, 2023
@88250 88250 closed this as completed Apr 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants