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

update docs for string functions multi-match-any, multi-search-all-positions, ngram-search and tokenize #1948

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

xiaokang
Copy link
Contributor

Versions

  • dev
  • 3.0
  • 2.1
  • 2.0

Languages

  • Chinese
  • English

Docs Checklist

  • Checked by AI
  • Test Cases Built

multi-search-all-positions, ngram-search and tokenize
multi-search-all-positions, ngram-search and tokenize
Copy link
Contributor

@morrySnow morrySnow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

只评论了第一个文件,麻烦都改一下


Checks whether the string `haystack` matches the regular expressions `patterns` in re2 syntax. returns 0 if none of the regular expressions are matched and 1 if any of the patterns matches.
```sql
TINYINT multi_match_any(VARCHAR haystack, ARRAY<VARCHAR> patterns)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. 不用参数类型和返回类型
  2. 函数名大写
  3. 参数需要尖括号包裹
Suggested change
TINYINT multi_match_any(VARCHAR haystack, ARRAY<VARCHAR> patterns)
MULTI_MATCH_ANY(<haystack>, <patterns>)

Comment on lines +41 to +42
| `haystack` | The string to be checked |
| `patterns` | Array of regular expressions |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
| `haystack` | The string to be checked |
| `patterns` | Array of regular expressions |
| `<haystack>` | The string to be checked |
| `<patterns>` | Array of regular expressions |


## Return Value

Returns 1 if the string `haystack` matches any of the regular expressions in the `patterns` array, otherwise returns 0.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Returns 1 if the string `haystack` matches any of the regular expressions in the `patterns` array, otherwise returns 0.
Returns 1 if the string `<haystack>` matches any of the regular expressions in the `<patterns>` array, otherwise returns 0.

## Examples

```sql
mysql> SELECT multi_match_any('Hello, World!', ['hello', '!', 'world']);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

不要prompt

Suggested change
mysql> SELECT multi_match_any('Hello, World!', ['hello', '!', 'world']);
SELECT multi_match_any('Hello, World!', ['hello', '!', 'world']);

Comment on lines 52 to 56
+-----------------------------------------------------------+
| multi_match_any('Hello, World!', ['hello', '!', 'world']) |
+-----------------------------------------------------------+
| 1 |
+-----------------------------------------------------------+
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

结果和查询分开放到两个 code block 中,结果使用 text 格式

```text
+-----------------------------------------------------------+
| multi_match_any('Hello, World!', ['hello', '!', 'world']) |
+-----------------------------------------------------------+
| 1                                                         |
+-----------------------------------------------------------+
```

@KassieZ KassieZ added has comments Some comments not resolved yet and removed request review labels Feb 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
has comments Some comments not resolved yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants