Skip to content

Commit

Permalink
Update the description of the usage of match_phrase_prefix. (#1726)
Browse files Browse the repository at this point in the history
  • Loading branch information
zzzxl1993 authored Jan 9, 2025
1 parent bf3283b commit b350d2b
Show file tree
Hide file tree
Showing 8 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/table-design/index/inverted-index.md
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,7 @@ SELECT * FROM table_name WHERE content MATCH_PHRASE 'keyword1 keyword2 ~3';
SELECT * FROM table_name WHERE content MATCH_PHRASE 'keyword1 keyword2 ~3+';

-- 2.3 Prefix matching the last word keyword2, with a default limit of 50 prefixes (controlled by session variable inverted_index_max_expansions)
-- It is necessary to ensure that keyword1 and keyword2 remain adjacent in the original text after tokenization, with no other words in between.
-- 'keyword1 keyword2abc' matches because keyword1 is identical and keyword2abc is a prefix of keyword2
-- 'keyword1 keyword2' also matches because keyword2 is a prefix of keyword2
-- 'keyword1 keyword3' does not match because keyword3 is not a prefix of keyword2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,7 @@ SELECT * FROM table_name WHERE content MATCH_PHRASE 'keyword1 keyword2 ~3';
SELECT * FROM table_name WHERE content MATCH_PHRASE 'keyword1 keyword2 ~3+';

-- 2.3 在保持词顺序的前提下,对最后一个词 keyword2 做前缀匹配,默认找 50 个前缀词(session 变量 inverted_index_max_expansions 控制)
-- 需要保证 keyword1, keyword2 在原文分词后也是相邻的,不能中间有其他词
-- 'keyword1 keyword2abc' 能匹配,因为 keyword1 完全一样,最后一个 keyword2abc 是 keyword2 的前缀
-- 'keyword1 keyword2' 也能匹配,因为 keyword2 也是 keyword2 的前缀
-- 'keyword1 keyword3' 不能匹配,因为 keyword3 不是 keyword2 的前缀
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,7 @@ SELECT * FROM table_name WHERE content MATCH_PHRASE 'keyword1 keyword2 ~3';
SELECT * FROM table_name WHERE content MATCH_PHRASE 'keyword1 keyword2 ~3+';

-- 2.3 在保持词顺序的前提下,对最后一个词 keyword2 做前缀匹配,默认找 50 个前缀词(session 变量 inverted_index_max_expansions 控制)
-- 需要保证 keyword1, keyword2 在原文分词后也是相邻的,不能中间有其他词
-- 'keyword1 keyword2abc' 能匹配,因为 keyword1 完全一样,最后一个 keyword2abc 是 keyword2 的前缀
-- 'keyword1 keyword2' 也能匹配,因为 keyword2 也是 keyword2 的前缀
-- 'keyword1 keyword3' 不能匹配,因为 keyword3 不是 keyword2 的前缀
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,7 @@ SELECT * FROM table_name WHERE content MATCH_PHRASE 'keyword1 keyword2 ~3';
SELECT * FROM table_name WHERE content MATCH_PHRASE 'keyword1 keyword2 ~3+';

-- 2.3 在保持词顺序的前提下,对最后一个词 keyword2 做前缀匹配,默认找 50 个前缀词(session 变量 inverted_index_max_expansions 控制)
-- 需要保证 keyword1, keyword2 在原文分词后也是相邻的,不能中间有其他词
-- 'keyword1 keyword2abc' 能匹配,因为 keyword1 完全一样,最后一个 keyword2abc 是 keyword2 的前缀
-- 'keyword1 keyword2' 也能匹配,因为 keyword2 也是 keyword2 的前缀
-- 'keyword1 keyword3' 不能匹配,因为 keyword3 不是 keyword2 的前缀
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,7 @@ SELECT * FROM table_name WHERE content MATCH_PHRASE 'keyword1 keyword2 ~3';
SELECT * FROM table_name WHERE content MATCH_PHRASE 'keyword1 keyword2 ~3+';

-- 2.3 在保持词顺序的前提下,对最后一个词 keyword2 做前缀匹配,默认找 50 个前缀词(session 变量 inverted_index_max_expansions 控制)
-- 需要保证 keyword1, keyword2 在原文分词后也是相邻的,不能中间有其他词
-- 'keyword1 keyword2abc' 能匹配,因为 keyword1 完全一样,最后一个 keyword2abc 是 keyword2 的前缀
-- 'keyword1 keyword2' 也能匹配,因为 keyword2 也是 keyword2 的前缀
-- 'keyword1 keyword3' 不能匹配,因为 keyword3 不是 keyword2 的前缀
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,7 @@ SELECT * FROM table_name WHERE content MATCH_PHRASE 'keyword1 keyword2 ~3';
SELECT * FROM table_name WHERE content MATCH_PHRASE 'keyword1 keyword2 ~3+';

-- 2.3 Prefix matching the last word keyword2, with a default limit of 50 prefixes (controlled by session variable inverted_index_max_expansions)
-- It is necessary to ensure that keyword1 and keyword2 remain adjacent in the original text after tokenization, with no other words in between.
-- 'keyword1 keyword2abc' matches because keyword1 is identical and keyword2abc is a prefix of keyword2
-- 'keyword1 keyword2' also matches because keyword2 is a prefix of keyword2
-- 'keyword1 keyword3' does not match because keyword3 is not a prefix of keyword2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,7 @@ SELECT * FROM table_name WHERE content MATCH_PHRASE 'keyword1 keyword2 ~3';
SELECT * FROM table_name WHERE content MATCH_PHRASE 'keyword1 keyword2 ~3+';

-- 2.3 Prefix matching the last word keyword2, with a default limit of 50 prefixes (controlled by session variable inverted_index_max_expansions)
-- It is necessary to ensure that keyword1 and keyword2 remain adjacent in the original text after tokenization, with no other words in between.
-- 'keyword1 keyword2abc' matches because keyword1 is identical and keyword2abc is a prefix of keyword2
-- 'keyword1 keyword2' also matches because keyword2 is a prefix of keyword2
-- 'keyword1 keyword3' does not match because keyword3 is not a prefix of keyword2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,7 @@ SELECT * FROM table_name WHERE content MATCH_PHRASE 'keyword1 keyword2 ~3';
SELECT * FROM table_name WHERE content MATCH_PHRASE 'keyword1 keyword2 ~3+';

-- 2.3 Prefix matching the last word keyword2, with a default limit of 50 prefixes (controlled by session variable inverted_index_max_expansions)
-- It is necessary to ensure that keyword1 and keyword2 remain adjacent in the original text after tokenization, with no other words in between.
-- 'keyword1 keyword2abc' matches because keyword1 is identical and keyword2abc is a prefix of keyword2
-- 'keyword1 keyword2' also matches because keyword2 is a prefix of keyword2
-- 'keyword1 keyword3' does not match because keyword3 is not a prefix of keyword2
Expand Down

0 comments on commit b350d2b

Please sign in to comment.