{"id":15045047,"url":"https://github.com/nelmio/nelmiosolariumbundle","last_synced_at":"2025-05-15T01:04:32.120Z","repository":{"id":1993358,"uuid":"2926106","full_name":"nelmio/NelmioSolariumBundle","owner":"nelmio","description":"Integration between Symfony and the Solarium Solr client.","archived":false,"fork":false,"pushed_at":"2025-02-25T07:27:08.000Z","size":198,"stargazers_count":149,"open_issues_count":0,"forks_count":60,"subscribers_count":11,"default_branch":"master","last_synced_at":"2025-04-02T09:45:59.019Z","etag":null,"topics":["php","solarium","symfony","symfony-bundle"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nelmio.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2011-12-06T16:36:30.000Z","updated_at":"2025-02-25T07:26:45.000Z","dependencies_parsed_at":"2024-09-25T01:55:33.936Z","dependency_job_id":"a41049f5-5e41-4998-af9e-a819f57aff95","html_url":"https://github.com/nelmio/NelmioSolariumBundle","commit_stats":{"total_commits":154,"total_committers":29,"mean_commits":5.310344827586207,"dds":0.7857142857142857,"last_synced_commit":"ebf0baafaa0c497f8669408000e788cababcc298"},"previous_names":[],"tags_count":23,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nelmio%2FNelmioSolariumBundle","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nelmio%2FNelmioSolariumBundle/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nelmio%2FNelmioSolariumBundle/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nelmio%2FNelmioSolariumBundle/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nelmio","download_url":"https://codeload.github.com/nelmio/NelmioSolariumBundle/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248027406,"owners_count":21035594,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["php","solarium","symfony","symfony-bundle"],"created_at":"2024-09-24T20:51:23.441Z","updated_at":"2025-04-09T11:04:54.628Z","avatar_url":"https://github.com/nelmio.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# NelmioSolarium Bundle\n\n[![Latest Version](https://img.shields.io/github/release/nelmio/NelmioSolariumBundle.svg?style=flat-square)](https://github.com/nelmio/NelmioSolariumBundle/releases)\n[![Total Downloads](https://img.shields.io/packagist/dt/nelmio/solarium-bundle.svg?style=flat-square)](https://packagist.org/packages/nelmio/solarium-bundle)\n\n## About\n\nThe NelmioSolariumBundle provides integration with the [solarium](http://www.solarium-project.org)\nsolr client.\n\n## Installation\n\nRequire the `nelmio/solarium-bundle` package in your composer.json and update your dependencies.\n\n```sh\n$ composer require nelmio/solarium-bundle\n```\n\nAdd the NelmioSolariumBundle to your AppKernel.php\n\n```php\npublic function registerBundles()\n{\n    $bundles = array(\n        ...\n        new Nelmio\\SolariumBundle\\NelmioSolariumBundle(),\n        ...\n    );\n    ...\n}\n```\n\n## Basic configuration\n\nQuick-start configuration:\n\n```yaml\nnelmio_solarium: ~\n```\n\nGives you a Solarium_Client service with default options (`http://localhost:8983/solr`)\n\n```php\n    $client = $this-\u003eget('solarium.client');\n```\n\nConfigure your endpoints in config.yml:\n\n```yaml\nnelmio_solarium:\n    endpoints:\n        default:\n            scheme: http\n            host: localhost\n            port: 8983\n            path: /solr\n            core: active\n    clients:\n        default:\n            endpoints: [default]\n```\n\nIf you only have one endpoint, the ```client``` section is not necessary\n\n## Usage\n\n```php\n$client = $this-\u003eget('solarium.client');\n$select = $client-\u003ecreateSelect();\n$select-\u003esetQuery('foo');\n$results = $client-\u003eselect($select);\n```\n\nFor more information see the [Solarium documentation](http://solarium.readthedocs.io/en/stable/).\n\n## Multiple clients and endpoints\n\n```yaml\nnelmio_solarium:\n    endpoints:\n        default:\n            host: 192.168.1.2\n        another:\n            host: 192.168.1.3\n    clients:\n        default:\n            endpoints: [default]\n        another:\n            endpoints: [another]\n```\n\n```php\n    $defaultClient = $this-\u003eget('solarium.client');\n    $anotherClient = $this-\u003eget('solarium.client.another');\n```\n\nYou may also change `default` name with your own, but don't forget change `default_client` option if you want to get access to\n`solarium.client` service\n\n```yaml\nnelmio_solarium:\n    default_client: firstOne\n    endpoints:\n        firstOne:\n            host: 192.168.1.2\n        anotherOne:\n            host: 192.168.1.3\n    clients:\n        firstOne:\n            endpoints: [firstOne]\n        anotherOne:\n            endpoints: [anotherOne]\n```\n\n```php\n    $firstOneClient = $this-\u003eget('solarium.client');\n    //or\n    $firstOneClient = $this-\u003eget('solarium.client.firstOne');\n\n    $anotherOneClient = $this-\u003eget('solarium.client.anotherOne');\n```\n\nStarting from Solarium 3.x you can also have multiple endpoints within the same client\n\n```yaml\nnelmio_solarium:\n    endpoints:\n        default:\n            host: 192.168.1.2\n        another:\n            host: 192.168.1.3\n    # if you are using all the endpoints, the clients section is not necessary\n    clients:\n        default:\n            endpoints: [default, another]\n```\n\nYou can also set which is the default endpoint\n\n```yaml\nnelmio_solarium:\n    endpoints:\n        default:\n            host: 192.168.1.2\n        another:\n            host: 192.168.1.3\n    clients:\n        default:\n            endpoints: [default, another]\n            default_endpoint: another\n```\n\nYou can combine both multiple client and endpoints too\n\n```yaml\nnelmio_solarium:\n    endpoints:\n        one:\n            host: 192.168.1.2\n        two:\n            host: 192.168.1.3\n        three:\n            host: 192.168.1.4\n    clients:\n        firstOne:\n            endpoints: [one, two]\n            default_endpoint: two\n        secondOne:\n            endpoints: [two, three]\n            default_endpoint: three\n```\n\n## Client registry\n\nYou can also use the service ```solarium.client_registry``` to access the clients you have configured using the names you have used in the configuration (with the example above):\n\n```php\n$registry = $this-\u003eget('solarium.client_registry');\n$firstOne = $registry-\u003egetClient('firstOne');\n$secondOne = $registry-\u003egetClient('secondOne');\n```\n\nor if you have configured a default client\n\n```php\n$registry = $this-\u003eget('solarium.client_registry');\n$default = $registry-\u003egetClient();\n```\n## Plugins\n\nSolarium works with plugins. If you want to use your own plugins, you can register a plugin in the bundle configuration either with a service id or the plugin class:\n\n```yaml\nnelmio_solarium:\n    clients:\n        default:\n            plugins:\n                test_plugin_service:\n                    plugin_service: plugin _service_id\n                test_plugin_classname:\n                    plugin_class: Some\\Plugin\\TestPlugin\n```\n\n## Overriding the Client class\n\nTo change the client class, you can set the client_class option:\n\n```yaml\nnelmio_solarium:\n    clients:\n        default:\n            client_class: Solarium\\Core\\Client\n```\n\n## Customizing the HTTP Adapter used by the Client\n\nIf you need to customize the Adapter that is used by the Client to perform HTTP requests to Solr then you can use the `adapter_service` option to specify the ID of a symfony service to be used as an adapter:\n\n```yaml\nnelmio_solarium:\n    clients:\n        default:\n            adapter_service: 'my.custom.adapter.service'\n```\n\n## HTTP Request timeout\n\nIf you are using the default adapter (`Curl`) and did not customize the `adapter_service` then you can use the `adapter_timeout` option to customize the timeout.\nSolarium uses a timeout of 5 seconds by default.\n\n```yaml\nnelmio_solarium:\n    clients:\n        default:\n            adapter_timeout: 10\n```\n\n## Loadbalancer Plugin\n\nSolarium ships with a loadbalancer plugin which can be configured via the `load_balancer` option on the client level.\n\nPassing a list of endpoints will assign equal weights of 1 and randomly pick an endpoint for each request.\n\n```yaml\nnelmio_solarium:\n    endpoints:\n        one:\n            host: 192.168.1.2\n        two:\n            host: 192.168.1.3\n        three:\n            host: 192.168.1.4\n    clients:\n        default:\n            load_balancer:\n                enabled: true\n                endpoints: [ one, two, three ] # will assign equal weights of 1\n```\n\nYou can also assign different weights (integers \u003e= 1) to the endpoints to have a more fine-grained control over the loadbalancing. \nThere are also options to customize the blocked query types and the default endpoint to use for those queries.\n\n```yaml\nnelmio_solarium:\n    endpoints:\n        one:\n            host: 192.168.1.2\n        two:\n            host: 192.168.1.3\n        three:\n            host: 192.168.1.4\n    clients:\n        default:\n            default_endpoint: two # the default endpoint to use for blocked query types \n            load_balancer:\n                enabled: true\n                blocked_query_types: [ 'select', 'update' ] # default is [ 'update' ]\n                endpoints: \n                    one: 1\n                    two: 2 # this endpoint will be used twice as often as the other two       \n                    three: 1\n```\n\nAlso see the Solarium documentation for the loadbalancer plugin: https://github.com/solariumphp/solarium/blob/master/docs/plugins.md#loadbalancer-plugin\n\n## License\n\nReleased under the MIT License, see LICENSE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnelmio%2Fnelmiosolariumbundle","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnelmio%2Fnelmiosolariumbundle","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnelmio%2Fnelmiosolariumbundle/lists"}