Skip to content

bigram_delimiter to find iphone 17 by iphone17 #4364

Description

@sanikolaev

Proposal:

Problem

It’s currently impossible to find iphone 17 using iphone17. For example:

mysql> drop table if exists t; create table t(f text); insert into t values(1, 'iphone 17'); select * from t where match('iphone17'); show meta;
--------------
drop table if exists t
--------------

Query OK, 0 rows affected (0.006 sec)

--------------
create table t(f text)
--------------

Query OK, 0 rows affected (0.003 sec)

--------------
insert into t values(1, 'iphone 17')
--------------

Query OK, 1 row affected (0.001 sec)

--------------
select * from t where match('iphone17')
--------------

Empty set (0.001 sec)
--- 0 out of 0 results in 0ms ---

--------------
show meta
--------------

+----------------+----------+
| Variable_name  | Value    |
+----------------+----------+
| total          | 0        |
| total_found    | 0        |
| total_relation | eq       |
| time           | 0.000    |
| keyword[0]     | iphone17 |
| docs[0]        | 0        |
| hits[0]        | 0        |
+----------------+----------+
7 rows in set (0.000 sec)

There's bigram_index, but it doesn't help because it inserts a special character between the tokens.

Proposal

Add a new setting: bigram_delimiter = {none|true|both}. bigram_delimiter = true is the current behavior. For bigram_delimiter = none, the words should be concatenated without a delimiter. For bigram_delimiter = both, it should produce both the delimited and non-delimited tokens.

Checklist:

To be completed by the assignee. Check off tasks that have been completed or are not applicable.

Details
  • Implementation completed
  • Tests developed
  • Documentation updated
  • Documentation reviewed
  • OpenAPI YAML updated and issue created to rebuild clients

Metadata

Metadata

Assignees

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions