All Projects → nelmio → Nelmiosolariumbundle

nelmio / Nelmiosolariumbundle

Licence: mit
Integration between Symfony and the Solarium Solr client.

Projects that are alternatives of or similar to Nelmiosolariumbundle

Liformbundle
Symfony Bundle to render Symfony Forms to JSON Schema
Stars: ✭ 124 (-12.06%)
Mutual labels:  symfony, symfony-bundle
Feedbundle
A Symfony bundle to build RSS feeds from your entities
Stars: ✭ 130 (-7.8%)
Mutual labels:  symfony, symfony-bundle
Crauegeobundle
Doctrine functions for calculating geographical distances in your Symfony project.
Stars: ✭ 112 (-20.57%)
Mutual labels:  symfony, symfony-bundle
Stofdoctrineextensionsbundle
Integration bundle for DoctrineExtensions by l3pp4rd in Symfony
Stars: ✭ 1,713 (+1114.89%)
Mutual labels:  symfony, symfony-bundle
Wouterjeloquentbundle
Integrates the Eloquent ORM in the Symfony framework
Stars: ✭ 126 (-10.64%)
Mutual labels:  symfony, symfony-bundle
Sonatanotificationbundle
Symfony SonataNotificationBundle
Stars: ✭ 136 (-3.55%)
Mutual labels:  symfony, symfony-bundle
Consolebundle
Commandline interface in browser for Symfony2
Stars: ✭ 138 (-2.13%)
Mutual labels:  symfony, symfony-bundle
Liipcachecontrolbundle
DEPRECATED! This bundle is superseded by FOSHttpCacheBundle. A migration guide is in the README of LiipCacheControlBundle
Stars: ✭ 108 (-23.4%)
Mutual labels:  symfony, symfony-bundle
Vichuploaderbundle
A simple Symfony bundle to ease file uploads with ORM entities and ODM documents.
Stars: ✭ 1,613 (+1043.97%)
Mutual labels:  symfony, symfony-bundle
Symfony Jsonapi
JSON API Transformer Bundle for Symfony 2 and Symfony 3
Stars: ✭ 114 (-19.15%)
Mutual labels:  symfony, symfony-bundle
Routing Bundle
Integrate the CMF Routing component as a Symfony2 bundle: Have the chain router and the dynamic router available in Symfony2
Stars: ✭ 124 (-12.06%)
Mutual labels:  symfony, symfony-bundle
Passwordstrengthbundle
Symfony Password strength and blacklisting validator bundle
Stars: ✭ 123 (-12.77%)
Mutual labels:  symfony, symfony-bundle
Slack Bundle
Symfony bundle integration of the nexylan/slack library.
Stars: ✭ 110 (-21.99%)
Mutual labels:  symfony, symfony-bundle
Webpack Bundle
Bundle to Integrate Webpack into Symfony
Stars: ✭ 124 (-12.06%)
Mutual labels:  symfony, symfony-bundle
Liipimaginebundle
Symfony Bundle to assist in imagine manipulation using the imagine library
Stars: ✭ 1,516 (+975.18%)
Mutual labels:  symfony, symfony-bundle
Core Bundle
[READ-ONLY] Contao Core Bundle
Stars: ✭ 113 (-19.86%)
Mutual labels:  symfony, symfony-bundle
Sonataseobundle
Symfony SonataSeoBundle
Stars: ✭ 106 (-24.82%)
Mutual labels:  symfony, symfony-bundle
Knppaginatorbundle
SEO friendly Symfony paginator to sort and paginate
Stars: ✭ 1,534 (+987.94%)
Mutual labels:  symfony, symfony-bundle
Nelmiocorsbundle
The NelmioCorsBundle allows you to send Cross-Origin Resource Sharing headers with ACL-style per-URL configuration.
Stars: ✭ 1,615 (+1045.39%)
Mutual labels:  symfony, symfony-bundle
Swiftmailer Bundle
Symfony Swiftmailer Bundle
Stars: ✭ 1,558 (+1004.96%)
Mutual labels:  symfony, symfony-bundle

NelmioSolarium Bundle

Latest Version Total Downloads

About

The NelmioSolariumBundle provides integration with the solarium solr client.

Installation

Require the nelmio/solarium-bundle package in your composer.json and update your dependencies.

$ composer require nelmio/solarium-bundle

Add the NelmioSolariumBundle to your AppKernel.php

public function registerBundles()
{
    $bundles = array(
        ...
        new Nelmio\SolariumBundle\NelmioSolariumBundle(),
        ...
    );
    ...
}

Basic configuration

Quick-start configuration:

nelmio_solarium: ~

Gives you a Solarium_Client service with default options (http://localhost:8983/solr)

    $client = $this->get('solarium.client');

Configure your endpoints in config.yml:

nelmio_solarium:
    endpoints:
        default:
            scheme: http
            host: localhost
            port: 8983
            path: /solr
            core: active
    clients:
        default:
            endpoints: [default]

If you only have one endpoint, the client section is not necessary

Usage

$client = $this->get('solarium.client');
$select = $client->createSelect();
$select->setQuery('foo');
$results = $client->select($select);

For more information see the Solarium documentation.

Multiple clients and endpoints

nelmio_solarium:
    endpoints:
        default:
            host: 192.168.1.2
        another:
            host: 192.168.1.3
    clients:
        default:
            endpoints: [default]
        another:
            endpoints: [another]
    $defaultClient = $this->get('solarium.client');
    $anotherClient = $this->get('solarium.client.another');

You may also change default name with your own, but don't forget change default_client option if you want to get access to solarium.client service

nelmio_solarium:
    default_client: firstOne
    endpoints:
        firstOne:
            host: 192.168.1.2
        anotherOne:
            host: 192.168.1.3
    clients:
        firstOne:
            endpoints: [firstOne]
        anotherOne:
            endpoints: [anotherOne]
    $firstOneClient = $this->get('solarium.client');
    //or
    $firstOneClient = $this->get('solarium.client.firstOne');

    $anotherOneClient = $this->get('solarium.client.anotherOne');

Starting from Solarium 3.x you can also have multiple endpoints within the same client

nelmio_solarium:
    endpoints:
        default:
            host: 192.168.1.2
        another:
            host: 192.168.1.3
    # if you are using all the endpoints, the clients section is not necessary
    clients:
        default:
            endpoints: [default, another]

You can also set which is the default endpoint

nelmio_solarium:
    endpoints:
        default:
            host: 192.168.1.2
        another:
            host: 192.168.1.3
    clients:
        default:
            endpoints: [default, another]
            default_endpoint: another

You can combine both multiple client and endpoints too

nelmio_solarium:
    endpoints:
        one:
            host: 192.168.1.2
        two:
            host: 192.168.1.3
        three:
            host: 192.168.1.4
    clients:
        firstOne:
            endpoints: [one, two]
            default_endpoint: two
        secondOne:
            endpoints: [two, three]
            default_endpoint: three

Client registry

You 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):

$registry = $this->get('solarium.client_registry');
$firstOne = $registry->getClient('firstOne');
$secondOne = $registry->getClient('secondOne');

or if you have configured a default client

$registry = $this->get('solarium.client_registry');
$default = $registry->getClient();

Plugins

Solarium 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:

nelmio_solarium:
    clients:
        default:
            plugins:
                test_plugin_service:
                    plugin_service: plugin _service_id
                test_plugin_classname:
                    plugin_class: Some\Plugin\TestPlugin

Overriding the Client class

To change the client class, you can set the client_class option:

nelmio_solarium:
    clients:
        default:
            client_class: Solarium\Core\Client

Customizing the HTTP Adapter used by the Client

If 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:

nelmio_solarium:
    clients:
        default:
            adapter_service: 'my.custom.adapter.service'

HTTP Request timeout

If 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. Solarium uses a timeout of 5 seconds by default.

nelmio_solarium:
    clients:
        default:
            adapter_timeout: 10

License

Released under the MIT License, see LICENSE.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].