- How do I integrate SEAL Solr Adapter into a Laravel application?
- Register the Solr client and adapter via a Laravel service provider. Bind the `SolrEngine` as a singleton in the container, using a DSN from `.env` or direct client configuration. Example: `$this->app->singleton(SolrEngine::class, fn($app) => new Engine(new SolrAdapter($solrClient), $app['schema']));`.
- Does this package support Laravel’s dependency injection?
- Yes. The adapter is designed to work with Laravel’s container. Configure it via a service provider, bind the `SolrAdapter` and `Engine` classes, and inject them into controllers or services. Use facades or direct container resolution for cleaner code.
- What Laravel versions are compatible with SEAL Solr Adapter?
- The package itself has no Laravel-specific dependencies, but it requires PHP 8.1+. For Laravel integration, ensure compatibility with `cmsig/seal` (check its docs) and use Laravel 9+ for modern DI features. Test thoroughly with your Laravel version.
- Can I use this adapter with standalone Solr (non-Cloud) instances?
- No. The adapter is explicitly designed for **SolrCloud** and uses collections for indexing. Standalone Solr instances won’t work without modifications. If you need standalone support, consider alternatives like `apache/solr-client-php` directly.
- How do I configure authentication for Solr in the DSN?
- Use the DSN format `solr://username:password@host:port`. For TLS, append `?tls=true`. Example: `solr://solr:SolrRocks@127.0.0.1:8983?tls=true`. Ensure your Solr instance accepts basic auth or configure it via `solr.disableConfigSetsCreateAuthChecks`.
- Is there a performance overhead compared to using Solarium directly?
- Yes, SEAL adds an abstraction layer on top of Solarium (or `apache/solr-client-php`). Benchmark your use case, but expect slightly higher latency due to schema validation and event dispatching. For high-throughput apps, direct Solr client calls may be faster.
- How do I handle Solr connection failures in production?
- Implement retry logic in your Laravel app or use SEAL’s event system to catch `DocumentIndexed`/`DocumentQuery` failures. Consider caching results or falling back to a secondary search engine (e.g., Elasticsearch) if SEAL supports multi-engine setups.
- What’s the difference between this adapter and using `apache/solr-client-php` directly?
- This adapter provides **schema abstraction** (via SEAL) for multi-engine support and Laravel-friendly DSN config. Direct `apache/solr-client-php` gives lower-level control (e.g., custom analyzers) but lacks SEAL’s portability. Choose this if you need SEAL’s features; otherwise, use the native client.
- Can I use this with Laravel Scout for model-based search?
- Not natively. SEAL Solr Adapter is a standalone search engine integration. To use it with Scout, create a custom `ScoutEngine` that bridges SEAL’s `Engine` to Scout’s `search()` and `index()` methods, mapping Laravel models to SEAL documents.
- How do I contribute or report issues for this package?
- File issues or feedback in the **main `cmsig/search` repository** (not this adapter’s repo). The project is community-driven; check the [SEAL discussions](https://github.com/PHP-CMSIG/search/discussions) for active development threads. Pull requests should target the `search` project.