← Home ← Codex ← DEBT
Browse by Category
+ added · updated 7d
← Back to glossary

Meilisearch & Typesense

Search PHP 7.0+ Intermediate
debt(d7/e5/b5/t5)
d7 Detectability Operational debt — how invisible misuse is to your safety net

Closest to 'only careful code review or runtime testing' (d7). The detection_hints note automated=no and the code_pattern is a symptom (LIKE '%term%' full scan, MySQL FULLTEXT at limits) that only surfaces under load or careful review. Laravel Scout is listed as a tool but it doesn't flag 'you should be using Meilisearch instead' — it only helps once you've already made the switch. Degraded search relevance or missing typo-tolerance is silent in normal development until users complain.

e5 Effort Remediation debt — work required to fix once spotted

Closest to 'touches multiple files / significant refactor in one component' (e5). The quick_fix describes swapping to Meilisearch/Typesense, but the common_mistakes reveal that misconfiguration (filterable/sortable attributes, indexable fields, attribute priority) requires re-indexing, queue worker setup, and schema decisions. This is more than a one-line patch — it involves infrastructure setup, model changes, queue integration, and index configuration across the application.

b5 Burden Structural debt — long-term weight of choosing wrong

Closest to 'persistent productivity tax' (b5). applies_to covers web and api contexts broadly. Once adopted, the search engine becomes a dependency every future developer must understand: index configuration, re-indexing on schema changes, queue workers for updates, and devops concerns (self-hosted). It affects multiple workstreams (backend, devops, data modeling) but doesn't define the entire system shape.

t5 Trap Cognitive debt — how counter-intuitive correct behaviour is

Closest to 'notable trap (a documented gotcha most devs eventually learn)' (t5). The misconception is that Elasticsearch is required for production search, leading teams to over-engineer or avoid adding search altogether. The common_mistakes reveal additional traps: real-time indexing blocking requests, and needing to configure filterable/sortable attributes before indexing (re-indexing required if missed). These are documented gotchas that experienced developers learn but are non-obvious to newcomers.

About DEBT scoring →

Also Known As

Meilisearch Typesense self-hosted search open-source search

TL;DR

Open-source, self-hosted search engines with PHP SDKs — fast BM25 search, typo-tolerance, and faceting without the operational complexity of Elasticsearch.

Explanation

Meilisearch (Rust, MIT license) and Typesense (C++, open core) are modern search servers optimised for developer experience. Both provide: BM25 relevance ranking, typo-tolerance, faceting and filtering, geosearch, and sub-50ms response times. Meilisearch has a simpler API and easier setup; Typesense has stronger multi-tenancy support. Both have official PHP SDKs. For most PHP applications needing search, either is a better choice than Elasticsearch due to lower operational overhead and simpler configuration.

Common Misconception

Elasticsearch is required for production search — Elasticsearch is powerful but operationally complex; Meilisearch handles most search needs with 10x less operational overhead and a simpler PHP integration.

Why It Matters

A PHP glossary with LIKE search returns misspelled terms as 'not found' — Meilisearch's typo-tolerance matches 'php arry' to 'php array' automatically, with no extra code.

Common Mistakes

  • Indexing data in real-time on every write — batch index updates in a queue worker to avoid blocking requests.
  • Not configuring filterable and sortable attributes before indexing — adding them later requires re-indexing.
  • Storing all document fields in the search index — only index searchable fields; store others in your DB.
  • Not setting searchable attributes priority — title should rank higher than body text.

Code Examples

✗ Vulnerable
// LIKE search — slow, no relevance, no typo tolerance:
$results = $pdo->query(
    "SELECT * FROM glossary WHERE term LIKE '%" . $db->escape($q) . "%'
     OR body LIKE '%" . $db->escape($q) . "%'"
)->fetchAll();
// Issues: no ranking, O(n) scan, no typos, injection risk
✓ Fixed
// Meilisearch PHP SDK:
$client = new \Meilisearch\Client('http://localhost:7700');
$index  = $client->index('glossary');

// Index a term:
$index->addDocuments([[
    'id'       => $term['slug'],
    'term'     => $term['term'],
    'short'    => $term['short'],
    'category' => $term['category'],
]]);

// Search:
$results = $index->search($query, [
    'limit'   => 20,
    'filter'  => 'category = security',
    'sort'    => ['term:asc'],
]);
// Typo-tolerant, ranked, facetable — 5ms response

Added 16 Mar 2026
Edited 22 Mar 2026
Views 52
Rate this term
No ratings yet
🤖 AI Guestbook educational data only
| |
Last 30 days
0 pings T 0 pings W 1 ping T 0 pings F 0 pings S 0 pings S 0 pings M 0 pings T 0 pings W 0 pings T 0 pings F 3 pings S 1 ping S 4 pings M 0 pings T 0 pings W 0 pings T 0 pings F 0 pings S 1 ping S 0 pings M 1 ping T 1 ping W 1 ping T 0 pings F 1 ping S 1 ping S 0 pings M 1 ping T 0 pings W
No pings yet today
PetalBot 1
Amazonbot 7 Perplexity 7 Scrapy 6 Ahrefs 4 Google 3 ChatGPT 3 Unknown AI 2 Claude 2 PetalBot 2 Bing 1 Meta AI 1 Majestic 1 Qwen 1 SEMrush 1
crawler 38 crawler_json 3
DEV INTEL Tools & Severity
🟡 Medium ⚙ Fix effort: Medium
⚡ Quick Fix
Use Meilisearch for self-hosted search (zero config, excellent defaults) or Typesense for a simpler managed option — both are dramatically simpler than Elasticsearch for typical PHP app search
📦 Applies To
PHP 7.0+ web api laravel
🔗 Prerequisites
🔍 Detection Hints
LIKE '%term%' full scan; MySQL FULLTEXT at its limits with poor relevance; Elasticsearch overkill for app search feature
Auto-detectable: ✗ No laravel-scout meilisearch typesense
⚠ Related Problems
🤖 AI Agent
Confidence: Low False Positives: Medium ✗ Manual fix Fix: Medium Context: File Tests: Update


✓ schema.org compliant