MariaDB FULLTEXT search with short / mandatory words Just checking I'm understanding this correctly:
CREATE TABLE customer (
    id INT NOT NULL AUTO_INCREMENT,
    name TINYTEXT NOT NULL,
    PRIMARY KEY (id),
    FULLTEXT (name)
) ENGINE = InnoDB;

INSERT INTO customer VALUES (1, &quot;ABC.DEF&quot;);
INSERT INTO customer VALUES (2, &quot;ABC_DEF&quot;);
INSERT INTO customer VALUES (3, &quot;ABC'DEF&quot;);
INSERT INTO customer VALUES (4, &quot;ABC.DE&quot;);
INSERT INTO customer VALUES (5, &quot;ABC.DFF&quot;);

Where I've got innodb_ft_min_token_size set to 3 (default is 4).

When running:
SELECT
    c.*,
    MATCH (name) AGAINST (&quot;+ABC +DEF&quot; IN BOOLEAN MODE) AS m
FROM
    customer AS c

Customers 1 and 3 match, because the . and ' are seen as word separators (annoying for O'Brien).
For customer 2, because the underscore gets the whole name treated as a single word, the &quot;DEF&quot; word cannot be found.

If I change the MATCH to &quot;+ABC +DE&quot;.
1, 2, or 3 do not match because this is using a full word match (&quot;+DE&quot; does not match &quot;DEF&quot;).
4 does not match because... innodb_ft_min_token_size is set to 3?
As in, the 2 letter &quot;DE&quot; word is not in the FULLTEXT INDEX?

If I change the MATCH to use asterisks (e.g. &quot;+ABC* +DE*&quot;), that will use prefix matching.
But will only add customers 1 and 3 to the selection.
Because the 2 letter &quot;DE&quot; word for customer 4 is not in the FULLTEXT INDEX?

If I change the MATCH to use &quot;+ABC.DE*&quot;, it matches all of them.
Note how they all get the same rank (even customer 5), and this is no different to &quot;+ABC*&quot;, where MATCH seems to be seeing the &quot;DE*&quot; as a separate word, and not matching it against anything.
Whereas &quot;+ABC DE*&quot; is explicitly keeping it as a separate word, and the scores are handled appropriately.

While the individual points make sense, I'm not sure this creates a good system.
For a bit more consistency, I'm wondering if the database should ignore short words (tokens) in the MATCH query, in the same way it does when building the FULLTEXT INDEX.
Only because I don't think &quot;+DE&quot; will ever do anything useful when the min token size is 3; and it's not exactly easy for the developer to identify what the individual words in the FULLTEXT INDEX will be (i.e. to remove them).
FULLTEXT is imperfect.  You are doing the 'right thing' to analyze the data it this way.  Now switch from &quot;abc&quot; and &quot;def&quot; to strings that are realistic in your dataset.
Here are a couple of tricks that I have used reasonably successfully.

Put a + in front of long words, don't put a + in front of short words.

Use this combo to check for things that need LIKE (or RLIKE) but desire the speed of FULLTEXT:
  WHERE MATCH(text) AGAINST ('abc def IN BOOLEAN MODE')
    AND text LIKE '%abc+def%'



That is, use FT to find rows with the &quot;words&quot;, then use LIKE to make sure they are adjacent and/or contain certain punctuation.