(blue star) Phrase Matching ("word1 word2")

This is used to search for exact phrases, with:

Example:

MATCH(content) AGAINST('"gene therapy" IN BOOLEAN MODE) 

(tick) Matches:

(error) Doesn’t match:

Phrase matching is strict β€” it's looking for gene immediately followed by therapy.


🧲 Proximity Matching ("word1 word2" @N)

This is used to search for all words appearing close together, regardless of order, and allows for flexibility in between.

Example:

MATCH(content) AGAINST('"gene therapy" @3' IN BOOLEAN MODE) 

(tick) Matches:

(error) Doesn’t match:

So while "gene therapy" (phrase) only matches that exact sequence, "gene therapy" @3 allows them to be near each other in any order and with some wiggle room between them.


πŸ†š Summary Comparison

Feature

Phrase Match
("word1 word2")

Proximity Match
("word1 word2" @N)

Word Order Matters

βœ… Yes

❌ No

Must be Adjacent

βœ… Yes

❌ No (within N words)

Allows Intervening Words

❌ No

βœ… Yes (up to N-1 words)

Use Case

Exact matches (e.g., quotes)

Conceptual closeness

Flexibility

❌ Rigid

βœ… Flexible

Available in BOOLEAN MODE?

βœ… Yes

βœ… Yes (InnoDB only)


(blue star) When to use which?


References: