handcraftedinthealps/zendsearch
Laravel-friendly integration of ZendSearch/Lucene for fast full‑text search in your app. Index Eloquent models, run queries with relevance scoring, and manage indexing via simple services/commands—ideal for lightweight search without external engines.
Search::index(), Search::query()).created/updated/deleted.where(), orWhere()) cannot directly translate to ZendSearch syntax. Requires custom query builders or DSL wrappers.where() clauses) to map to ZendSearch syntax."handcraftedinthealps/zendsearch": "^1.0").$this->app->singleton('search', function ($app) {
return new \ZendSearch\Lucene\Search\Search(
storage_path('app/zendsearch_index')
);
});
class ProductObserver {
public function saved(Model $model) {
$index = app('search')->index();
$index->addDocument($model->toSearchableArray());
}
}
Search::query()
->term('title', 'laptop')
->range('price', ['min' => 500])
->execute();
LIKE '%term%' queries) with ZendSearch for non-critical endpoints first.scout:import or scout:flush.memory_limit (e.g., 512M–1G) for large indexes.storage/app/zendsearch_index (e.g., daily snapshots).var_dump() or custom logging for query analysis.microtime().opcache, realpath_cache_size).index_1, index_2).O(n)) for large datasets. Batch indexing recommended.| Failure Scenario | Impact | Mitigation |
|---|---|---|
| Disk full (index files) | Search breaks, app crashes | Set up disk alerts, monitor index size. |
| Corrupted index files | Inconsistent search results | Regular backups, test restore procedure. |
| High memory usage | PHP worker crashes | Optimize document structure, increase |
How can I help you explore Laravel packages today?