Show HN: PHP-fts – Full-text search engine in pure PHP, no extensions

· devtools · Source ↗

TLDR

  • Self-contained PHP 8.1+ full-text search library using trigram indexing and BM25+IDF scoring, requiring zero extensions or external services.

Key Takeaways

  • Targets shared hosting and minimal-stack deployments (OVH, Infomaniak, o2switch); not a replacement for Elasticsearch or Meilisearch at scale.
  • Uses a fixed-size ~810 KB trigram index (trigrams.bin) with O(1) lookup; supports typo tolerance, field boosting, and AND/OR filters.
  • BM25 scoring uses standard Lucene defaults (k1=1.5, b=0.75); scores normalized 0-100 and exposed per result for custom ranking.
  • insertBulk() is ~2x faster than single inserts; on 10k docs at Linux shared hosting, median search latency is 3.2 ms, P99 is 22.9 ms.
  • Index files are fully portable binary files; soft deletes via tombstones with compact() for cleanup when fragmentation exceeds threshold.

Hacker News Comment Review

  • No substantive HN discussion yet.

Original | Discuss on HN