Skip to end of metadata
Go to start of metadata

You are viewing an old version of this content. View the current version.

Compare with Current View Version History

Version 1 Next »

🔤 Phrase Matching ("word1 word2")

This is used to search for exact phrases, with:

  • Exact order

  • No extra words in between

  • No variations

Example:

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

(tick) Matches:

  • "gene therapy is promising"

(error) Doesn’t match:

  • "therapy for gene mutation"

  • "gene-based cell therapy"

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:

  • "gene therapy is promising" âś… (distance: 1)

  • "therapy for gene mutation" âś… (distance: 2 — therapy, for, gene)

  • "a therapy based on gene editing" âś… (distance: 3 — within threshold)

(error) Doesn’t match:

  • "gene expression has little relation to cell therapy" ❌ (too far apart)

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)


🤔 When to use which?

  • Use phrase matching when you're looking for exact quotations or tight phrases (e.g., "climate change", "artificial intelligence").

  • Use proximity search when you're more interested in conceptual relevance, especially in large or noisy text fields (e.g., medical records, article abstracts, etc.).


References:

  • No labels