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
Search Bundle

Search Bundle Laravel Package

atoolo/search-bundle

View on GitHub
Deep Wiki
Context7

Indexing und searching

Frequently asked questions about Search Bundle
How do I install **atoolo/search-bundle** in a Laravel project?
Use Composer to install the bundle (`composer require sitepark/atoolo-search-bundle`), then register it in `config/app.php` under `providers`. Since it’s Symfony-based, you may need to alias Symfony services in a Laravel `ServiceProvider` (e.g., `SearchClient`). Follow the [official docs](https://sitepark.github.io/atoolo-docs/) for Symfony-Laravel integration steps.
Does this bundle work with Laravel’s Eloquent models, or only Symfony entities?
The bundle primarily works with **atoolo/resource-bundle** resources, which can map to Eloquent models via custom `Resource` implementations. If your models don’t align, extend the `ResourceBundle` interfaces or use DTOs to bridge the gap. The README and docs provide examples for custom mappings.
What Laravel versions are supported, and is it compatible with PHP 8.4?
The bundle supports **PHP 8.1–8.4** and integrates with Laravel 9+ (tested with Symfony 6/7). While it’s Symfony-native, Laravel’s DI container can handle it with minor service aliasing. Check the [GitHub actions](https://github.com/sitepark/atoolo-search-bundle) for the latest compatibility badges.
How do I set up real-time indexing for Eloquent model updates?
Use Laravel’s event system to trigger indexing. For example, listen to `ModelUpdated` events and dispatch a queue job to run `atoolo-search-bundle`'s `IndexerCommand`. The bundle supports background indexing via CLI commands or queues, so you can offload heavy indexing tasks.
Can I use this bundle without a self-hosted Solr instance? What about SolrCloud?
Yes, the bundle works with **SolrCloud** or managed Solr services (e.g., AWS OpenSearch, Solr hosted solutions). Configure the `SearchClient` to point to your Solr endpoint (e.g., `http://solr.example.com:8983/solr`). Test with a staging instance first to validate schema compatibility and performance.
What happens if Solr is down? Does the bundle have fallback mechanisms?
The bundle doesn’t include built-in fallbacks, but you can implement them in your Laravel app. For example, cache search results in Redis or fall back to a slower database query. Use Laravel’s `try-catch` blocks around Solr calls to handle failures gracefully.
How do I handle faceted search (filters) in Laravel Blade or API responses?
The bundle returns faceted search results as structured data (e.g., JSON). For Blade views, loop through the `facet_counts` array in the response. For APIs, return the data directly or transform it with Laravel’s `Resource` classes. Example: `return response()->json($searchResult->getFacetCounts());`
Are there alternatives to this bundle for Laravel Solr integration?
Yes, alternatives include **laravel-solr** (simpler but less feature-rich) or **scout-apache-solr** (for Laravel Scout). However, **atoolo/search-bundle** stands out for its **event-driven indexing**, **Symfony integration**, and support for complex queries (geospatial, spellcheck). Choose based on your need for scalability vs. simplicity.
How do I configure Solr schema fields to match my Laravel model structure?
Map your Laravel model fields to Solr’s `managed-schema` using the bundle’s `IndexSchema2xDocument` interface. For example, add `sp_startletter` for sorting or `sp_sortvalue` for custom ordering. Use Solr’s dynamic fields if your models evolve frequently. Validate the schema against the bundle’s defaults before deployment.
Can I test this bundle locally without a full Solr setup?
Yes, use **Docker** to spin up a local Solr instance (e.g., `docker run -p 8983:8983 solr:latest`). The bundle also supports **in-memory testing** with a mock `SearchClient`. Configure your `.env` to point to the local Solr URL and use Laravel’s `Mockery` or `PHPUnit` to test indexing logic without a real Solr cluster.
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.
terminal42/code-quality-tools
codifyo/ts-generator-bundle
andydefer/laravel-cluster
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky