Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Tntsearch Laravel Package

teamtnt/tntsearch

TNTSearch is a pure-PHP full-text search engine with fuzzy search, “search as you type”, geo-search, stemming, custom tokenizers, BM25 ranking, boolean queries, highlighting, and dynamic index updates—fast to integrate and deploy via Packagist.

View on GitHub
Deep Wiki
Context7

A fully featured full text search engine written in PHP

Frequently asked questions about Tntsearch
How do I integrate TNTSearch with Laravel Scout for Eloquent model search?
Install the official driver via Composer (`composer require teamtnt/laravel-scout-tntsearch-driver`), then configure your `config/scout.php` to use the `tntsearch` driver. Call `Model::search($query)` as usual—Scout handles indexing and querying automatically. Dynamic updates sync with database changes via Scout’s `save()`/`delete()` hooks.
What Laravel versions does TNTSearch support?
TNTSearch works with Laravel 8.x, 9.x, and 10.x. The `laravel-scout-tntsearch-driver` package ensures compatibility with Scout’s latest API. Check the [GitHub releases](https://github.com/teamtnt/tntsearch/releases) for version-specific notes, as Scout integration may require minor adjustments for older Laravel versions.
Can TNTSearch handle geo-search for location-based queries?
Yes, TNTSearch supports geo-search using latitude/longitude coordinates. Store these as columns in your Eloquent models, then query with `Model::search($query)->near([lat, lng], $distance)`. For Laravel, pair it with `spatie/laravel-geo` to normalize coordinates. Geo-search requires indexing the location fields explicitly.
How does TNTSearch perform with large datasets (e.g., 1M+ records)?
TNTSearch is optimized for small-to-medium datasets (up to ~10M rows with tuning). For 1M+ records, use the Redis backend to reduce I/O latency, enable BM25 ranking for relevance, and avoid custom tokenizers. Benchmark with your data volume—PHP’s single-threaded nature may require sharding indexes manually for horizontal scaling.
What storage backends does TNTSearch support, and which is best for production?
TNTSearch supports SQLite (filesystem), MySQL, and Redis backends. For production, Redis is ideal for low-latency indexing and dynamic updates, while MySQL avoids filesystem bloat. SQLite is simplest for small projects but risks storage limits. Always monitor index sizes and prune stale data.
How do I implement fuzzy search or 'search as you type' with TNTSearch?
Enable fuzzy search by configuring the `fuzzy` option in your TNTSearch index definition (e.g., `fuzzy: true`). For 'search as you type,' use the `prefix` or `ngram` tokenizers in your query. TNTSearch includes built-in helpers like Jaro-Winkler similarity for distance-based matching. Test with `Model::search($query)->fuzzy(true)` in Laravel Scout.
Are there alternatives to TNTSearch for Laravel if I need distributed scaling?
For distributed scaling, consider Elasticsearch (via `laravel-scout-elasticsearch-driver`) or Algolia. TNTSearch lacks native clustering, but you can shard indexes manually or use a microservice architecture. If you need a lightweight alternative, Meilisearch (via `meilisearch/meilisearch-php`) offers similar features with better horizontal scaling.
How do I update the index dynamically without full reindexing?
TNTSearch supports incremental updates via Scout’s `save()`/`delete()` hooks in Laravel. When a model is updated/deleted, Scout triggers TNTSearch to modify the index automatically. For direct API usage, call `index->updateDocument()` with the new data. Dynamic updates avoid downtime but may require tuning for high-frequency writes.
Can I use TNTSearch for multilingual search (e.g., Arabic, Chinese, Russian)?
TNTSearch includes stemmers for English, Croatian, Arabic, Italian, Russian, Portuguese, and Ukrainian. For Chinese, check community forks or implement a custom tokenizer using the Snowball stemmer API. Test relevance with your target languages—some may need manual tuning for optimal results.
What are the production deployment considerations for TNTSearch?
Deploy TNTSearch with Redis for best performance, and monitor memory usage during indexing. Use a dedicated queue worker for Scout jobs to avoid blocking requests. For SQLite, ensure the storage path has sufficient inodes and disk space. Backup indexes regularly, as they’re critical for search functionality. Consider containerizing with Docker for consistency.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
yandex/translate-api
voku/simple_html_dom
league/flysystem-vfs
bkwld/upchuck
filament/spatie-laravel-tags-plugin
capell-app/block-library
axium/identity
cetria/laravel-dummy-models
cetria/reflection-helper
agropredict/sso-auth-bundle
evolvestudio/spam-protection
datacore/hub-sdk
develia/commons
cuci/prototurk-sdk
cuci/prototurk-sdk-symfony
develia/geo-bundle
dreamzy/livewire-charts
touchestate-sdk/php-sdk
22h/doctrine-garbage-collection-bundle
agtp/agtp-php