Skip to content

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

Closed
@Zuoqiu-Yingyi

Description

@Zuoqiu-Yingyi
Contributor

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

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

Activity

changed the title [-]正则表达式模式下搜索失效 | The search fails in regular expression mode[/-] [+]The search fails in regular expression mode[/+] on Apr 2, 2023
88250

88250 commented on Apr 2, 2023

@88250
Member

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

Zuoqiu-Yingyi commented on Apr 2, 2023

@Zuoqiu-Yingyi
ContributorAuthor

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
}
self-assigned this
on Apr 3, 2023
changed the title [-]The search fails in regular expression mode[/-] [+]The search fails in regular expression with order by Relevance[/+] on Apr 3, 2023
added this to the 2.8.3 milestone on Apr 3, 2023
changed the title [-]The search fails in regular expression with order by Relevance[/-] [+]The search fails in regular expression with order by relevance[/+] on Apr 3, 2023
88250

88250 commented on Apr 3, 2023

@88250
Member

已经确认问题,同时也发现另一个问题,即相关度排序是通过 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.

changed the title [-]The search fails in regular expression with order by relevance[/-] [+]The search fails in regular expression/SQL with order by relevance[/+] on Apr 3, 2023
changed the title [-]The search fails in regular expression/SQL with order by relevance[/-] [+]The search fails in REGEXP/SQL with order by relevance[/+] on Apr 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

    Development

    No branches or pull requests

      Participants

      @88250@Zuoqiu-Yingyi

      Issue actions

        The search fails in REGEXP/SQL with order by relevance · Issue #7861 · siyuan-note/siyuan