From 9208b615cb2ed6f306be6e696431b6b71e4d42db Mon Sep 17 00:00:00 2001 From: David Maicher Date: Sat, 4 Apr 2020 00:16:30 +0200 Subject: [PATCH] adjust documentation for Client and Adapter changes in 5.2 (#773) --- docs/client-and-adapters.md | 66 +++++++++---------- docs/customizing-solarium.md | 9 ++- docs/documents.md | 10 ++- docs/getting-started.md | 38 +++++++++-- docs/plugins.md | 8 ++- .../analysis-query/analysis-document.md | 4 +- docs/queries/analysis-query/analysis-field.md | 4 +- docs/queries/extract-query.md | 4 +- docs/queries/ping-query.md | 4 +- docs/queries/query-helper/escaping.md | 4 +- docs/queries/query-helper/placeholders.md | 4 +- docs/queries/query-helper/query-helper.md | 4 +- docs/queries/realtimeget-query.md | 4 +- .../adding-filterqueries.md | 4 +- .../building-a-select-query.md | 8 ++- .../components/debug-component.md | 4 +- .../components/dismax-component.md | 4 +- .../distributed-search-component.md | 4 +- .../components/edismax-component.md | 4 +- .../facetset-component/facet-field.md | 4 +- .../facetset-component/facet-multiquery.md | 4 +- .../facetset-component/facet-pivot.md | 4 +- .../facetset-component/facet-query.md | 4 +- .../facetset-component/facet-range.md | 10 ++- .../components/grouping-component.md | 8 ++- .../components/highlighting-component.md | 8 ++- .../components/morelikethis-component.md | 4 +- .../components/query-elevation-component.md | 4 +- .../components/query-rerankquery-component.md | 4 +- .../components/spellcheck-component.md | 4 +- .../components/stats-component.md | 4 +- .../select-query/executing-a-select-query.md | 4 +- .../component-results/facetset-result.md | 16 +++-- .../component-results/grouping-result.md | 8 ++- .../component-results/highlighting-result.md | 4 +- .../component-results/morelikethis-result.md | 4 +- .../result-of-a-select-query.md | 4 +- docs/queries/server-query/core-admin-query.md | 4 +- docs/queries/suggester-query.md | 4 +- docs/queries/terms-query.md | 4 +- .../building-an-update-query/add-command.md | 4 +- .../building-an-update-query.md | 8 ++- .../commit-command.md | 4 +- .../delete-command.md | 8 ++- .../optimize-command.md | 4 +- .../rollback-command.md | 4 +- .../update-query/executing-an-update-query.md | 4 +- docs/solarium-concepts.md | 8 ++- 48 files changed, 246 insertions(+), 103 deletions(-) diff --git a/docs/client-and-adapters.md b/docs/client-and-adapters.md index 07bf78eb7..669693a7e 100644 --- a/docs/client-and-adapters.md +++ b/docs/client-and-adapters.md @@ -17,7 +17,16 @@ The adapters are the actual implementations for communication with Solr. They ha ### Authentication -The Http, Curl and Pecl adapter support authentication. To use this set the authentication on the request object using the setAuthentication() method. For the ZendHttp adapter you set the authentication using the ZendHttp api or config. +The Http and Curl adapter support authentication. To use this set the authentication on the request object using the setAuthentication() method. + +### HTTP request timeout handling + +Setting a timeout for the HTTP request handling is the responsibility of the Adapters. +The two build-in Adapters `Curl` and `Http` are implementing `TimeoutAwareInterface` and expose a `setTimeout` +method to give you control over the timeout value that is used. + +If you are using any other adapter like the build-in `Psr18Adapter` you need to take care of handling +the timeouts yourself and configure the HTTP client properly that is used to perform the requests. Endpoints --------- @@ -43,13 +52,7 @@ As this is the default adapter you don't need any settings or API calls to use i The curl adapter support the use of a proxy. Use the adapter option `proxy` to enable this. -Guzzle adapter -============== - -todo - - -HttpAdapter +Http adapter =========== This adapter has no dependencies on other classes or any special PHP extensions as it uses basic PHP streams. This makes it a safe choice, but it has no extra options. If you need detailed control over your request or response you should probably use another adapter, but for most standard cases it will do just fine. @@ -64,10 +67,11 @@ require(__DIR__.'/init.php'); htmlHeader(); // create a client instance -$client = new Solarium\Client($config); - -// set the adapter to curl -$client->setAdapter('Solarium\Core\Client\Adapter\Http'); +$client = new Solarium\Client( + new Solarium\Core\Client\Adapter\Http(), + new Symfony\Component\EventDispatcher\EventDispatcher(), + $config +); // get a select query instance $query = $client->createSelect(); @@ -100,34 +104,29 @@ htmlFooter(); ``` -Zend2Http adapter -================ - -The ZendHttp adapter makes use of the Zend\_Http component in Zend Framework (version 3). So to use this adapter you need to have ZF available. By using Zend\_Http all the features of this component are available: +Psr-18 adapter +============ -- multiple adapter implementations -- keepalive -- cookies / sessions -- redirection support -- http authentication -- and much more, see the [http://framework.zend.com/manual/en/zend.http.html Zend Http manual](http://framework.zend.com/manual/en/zend.http.html_Zend_Http_manual "wikilink") +Since Solarium 5.2 there is also a `Psr18Adapter` which can be used with any PSR-18 compliant HTTP client. -The base functionality is the same as the default adapter. The only difference is that this adapter allows you to set Zend\_Http options and also offers access to the Zend\_Http instance. +Example: ```php setAdapter('Solarium\Core\Client\Adapter\Zend2Http'); +use Nyholm\Psr7\Factory\Psr17Factory; +use Solarium\Client; +use Http\Adapter\Guzzle6\Client as GuzzlePsrClient; +use Solarium\Core\Client\Adapter\Psr18Adapter; +use Symfony\Component\EventDispatcher\EventDispatcher; -htmlFooter(); +$adapter = new Psr18Adapter( + new GuzzlePsrClient(), + new Psr17Factory(), + new Psr17Factory() +); +$client = new Client($adapter, new EventDispatcher()); ``` Custom adapter @@ -138,6 +137,5 @@ You can also use a custom adapter, with these steps: - Create your custom adapter class. It should implement Solarium\\Core\\Client\\Adapter\\AdapterInterface. - You can take a look at the existing implementations as an example. - Make sure your class is available to Solarium, by including it manually or through autoloading. -- Call the 'setAdapter' method on your Solarium client instance with your own adapters' classname as argument (or use the 'adapter' config setting) +- Inject your custom adapter instance into the constructor of the Client - Now use Solarium as you normally would, all communication to Solr will be done using your adapter. The adapter class will only be instantiated on the first communication to Solr, not directly after calling 'setAdapter' (lazy loading) - diff --git a/docs/customizing-solarium.md b/docs/customizing-solarium.md index 665c6f89c..bf3b1a979 100644 --- a/docs/customizing-solarium.md +++ b/docs/customizing-solarium.md @@ -38,9 +38,10 @@ htmlHeader(); // And you can use only a part of the flow. You could for instance use the query object and request builder, // but execute the request in your own code. +// ... // create a client instance -$client = new Solarium\Client($config); +$client = new Solarium\Client($adapter, $eventDispatcher, $config); // create a select query instance $query = $client->createSelect(); @@ -200,7 +201,11 @@ htmlHeader(); // create a client instance and register the plugin $plugin = new BasicDebug(); -$client = new Solarium\Client($config); + +// ... + +// create a client instance +$client = new Solarium\Client($adapter, $eventDispatcher, $config);; $client->registerPlugin('debugger', $plugin); // execute a select query and display the results diff --git a/docs/documents.md b/docs/documents.md index ab8a92e16..23ebe0a33 100644 --- a/docs/documents.md +++ b/docs/documents.md @@ -36,8 +36,10 @@ Example usage require(__DIR__.'/init.php'); htmlHeader(); +// ... + // create a client instance -$client = new Solarium\Client($config); +$client = new Solarium\Client($adapter, $eventDispatcher, $config); // get a select query instance $query = $client->createQuery($client::QUERY_SELECT); @@ -144,8 +146,10 @@ Example usage require(__DIR__.'/init.php'); htmlHeader(); +// ... + // create a client instance -$client = new Solarium\Client($config); +$client = new Solarium\Client($adapter, $eventDispatcher, $config); // get an update query instance $update = $client->createUpdate(); @@ -185,4 +189,4 @@ You can easily use your own 'document' types, for instance to directly map Solr - make sure the class is available (already loaded or can be autoloaded) - set the 'documentclass' option of your query to your own classname -- the class must implement the same interface as the original document class. \ No newline at end of file +- the class must implement the same interface as the original document class. diff --git a/docs/getting-started.md b/docs/getting-started.md index 87f770f70..f0389c88a 100644 --- a/docs/getting-started.md +++ b/docs/getting-started.md @@ -28,7 +28,7 @@ See [](https://packagist.org) for other packages. ```json { "require": { - "solarium/solarium": "~5.0.0" + "solarium/solarium": "^5.2" } } ``` @@ -55,7 +55,11 @@ htmlHeader(); echo 'Solarium library version: ' . Solarium\Client::VERSION . ' - '; // create a client instance -$client = new Solarium\Client($config); +$client = new Solarium\Client( + new Solarium\Core\Client\Adapter\Curl(), // or any other adapter implementing AdapterInterface + new Symfony\Component\EventDispatcher\EventDispatcher(), + $config +); // create a ping query $ping = $client->createPing(); @@ -147,7 +151,11 @@ require(__DIR__.'/init.php'); htmlHeader(); // create a client instance -$client = new Solarium\Client($config); +$client = new Solarium\Client( + new Solarium\Core\Client\Adapter\Curl(), // or any other adapter implementing AdapterInterface + new Symfony\Component\EventDispatcher\EventDispatcher(), + $config +); // get a select query instance $query = $client->createQuery($client::QUERY_SELECT); @@ -193,7 +201,11 @@ require(__DIR__.'/init.php'); htmlHeader(); // create a client instance -$client = new Solarium\Client($config); +$client = new Solarium\Client( + new Solarium\Core\Client\Adapter\Curl(), // or any other adapter implementing AdapterInterface + new Symfony\Component\EventDispatcher\EventDispatcher(), + $config +); // get a select query instance $query = $client->createSelect(); @@ -242,7 +254,11 @@ require(__DIR__.'/init.php'); htmlHeader(); // create a client instance -$client = new Solarium\Client($config); +$client = new Solarium\Client( + new Solarium\Core\Client\Adapter\Curl(), // or any other adapter implementing AdapterInterface + new Symfony\Component\EventDispatcher\EventDispatcher(), + $config +); // get an update query instance $update = $client->createUpdate(); @@ -271,7 +287,11 @@ require(__DIR__.'/init.php'); htmlHeader(); // create a client instance -$client = new Solarium\Client($config); +$client = new Solarium\Client( + new Solarium\Core\Client\Adapter\Curl(), // or any other adapter implementing AdapterInterface + new Symfony\Component\EventDispatcher\EventDispatcher(), + $config +); // get an update query instance $update = $client->createUpdate(); @@ -304,7 +324,11 @@ require(__DIR__.'/init.php'); htmlHeader(); // create a client instance -$client = new Solarium\Client($config); +$client = new Solarium\Client( + new Solarium\Core\Client\Adapter\Curl(), // or any other adapter implementing AdapterInterface + new Symfony\Component\EventDispatcher\EventDispatcher(), + $config +); // get an update query instance $update = $client->createUpdate(); diff --git a/docs/plugins.md b/docs/plugins.md index 026023a40..541482ee0 100644 --- a/docs/plugins.md +++ b/docs/plugins.md @@ -261,8 +261,10 @@ require(__DIR__.'/init.php'); htmlHeader(); +// ... + // create a client instance -$client = new Solarium\Client($config); +$client = new Solarium\Client($adapter, $eventDispatcher, $config); // enable the plugin and get a query instance $filter = $client->getPlugin('minimumscorefilter'); @@ -464,8 +466,10 @@ require(__DIR__.'/init.php'); htmlHeader(); +// ... + // create a client instance -$client = new Solarium\Client($config); +$client = new Solarium\Client($adapter, $eventDispatcher, $config); // get a select query instance $query = $client->createSelect(); diff --git a/docs/queries/analysis-query/analysis-document.md b/docs/queries/analysis-query/analysis-document.md index 4aa87250c..d8c84168a 100644 --- a/docs/queries/analysis-query/analysis-document.md +++ b/docs/queries/analysis-query/analysis-document.md @@ -34,8 +34,10 @@ Example require(__DIR__.'/init.php'); htmlHeader(); +// ... + // create a client instance -$client = new Solarium\Client($config); +$client = new Solarium\Client($adapter, $eventDispatcher, $config); // get an analysis document query $query = $client->createAnalysisDocument(); diff --git a/docs/queries/analysis-query/analysis-field.md b/docs/queries/analysis-query/analysis-field.md index e29d98463..f48f8fdf4 100644 --- a/docs/queries/analysis-query/analysis-field.md +++ b/docs/queries/analysis-query/analysis-field.md @@ -37,8 +37,10 @@ Example require(__DIR__.'/init.php'); htmlHeader(); +// ... + // create a client instance -$client = new Solarium\Client($config); +$client = new Solarium\Client($adapter, $eventDispatcher, $config); // get an analysis document query $query = $client->createAnalysisField(); diff --git a/docs/queries/extract-query.md b/docs/queries/extract-query.md index cf1619f5a..f720006d4 100644 --- a/docs/queries/extract-query.md +++ b/docs/queries/extract-query.md @@ -36,8 +36,10 @@ Example require(__DIR__.'/init.php'); htmlHeader(); +// ... + // create a client instance -$client = new Solarium\Client($config); +$client = new Solarium\Client($adapter, $eventDispatcher, $config); // get an extract query instance and add settings $query = $client->createExtract(); diff --git a/docs/queries/ping-query.md b/docs/queries/ping-query.md index 8a7677aa1..bd35ab2c7 100644 --- a/docs/queries/ping-query.md +++ b/docs/queries/ping-query.md @@ -38,8 +38,10 @@ htmlHeader(); // check solarium version available echo 'Solarium library version: ' . Solarium\Client::VERSION . ' - '; +// ... + // create a client instance -$client = new Solarium\Client($config); +$client = new Solarium\Client($adapter, $eventDispatcher, $config); // create a ping query $ping = $client->createPing(); diff --git a/docs/queries/query-helper/escaping.md b/docs/queries/query-helper/escaping.md index 3c5264602..e6bbaebbd 100644 --- a/docs/queries/query-helper/escaping.md +++ b/docs/queries/query-helper/escaping.md @@ -8,8 +8,10 @@ An example of term escaping in use for a query that would fail without escaping: require(__DIR__.'/init.php'); htmlHeader(); +// ... + // create a client instance -$client = new Solarium\Client($config); +$client = new Solarium\Client($adapter, $eventDispatcher, $config); // get a select query instance $query = $client->createSelect(); diff --git a/docs/queries/query-helper/placeholders.md b/docs/queries/query-helper/placeholders.md index 31ad45e02..7cb510f2b 100644 --- a/docs/queries/query-helper/placeholders.md +++ b/docs/queries/query-helper/placeholders.md @@ -38,8 +38,10 @@ Example require(__DIR__.'/init.php'); htmlHeader(); +// ... + // create a client instance -$client = new Solarium\Client($config); +$client = new Solarium\Client($adapter, $eventDispatcher, $config); // get a select query instance $query = $client->createSelect(); diff --git a/docs/queries/query-helper/query-helper.md b/docs/queries/query-helper/query-helper.md index 381ff41d5..292f1180d 100644 --- a/docs/queries/query-helper/query-helper.md +++ b/docs/queries/query-helper/query-helper.md @@ -36,8 +36,10 @@ Example require(__DIR__.'/init.php'); htmlHeader(); +// ... + // create a client instance -$client = new Solarium\Client($config); +$client = new Solarium\Client($adapter, $eventDispatcher, $config); // get a select query instance and a query helper instance $query = $client->createSelect(); diff --git a/docs/queries/realtimeget-query.md b/docs/queries/realtimeget-query.md index f23e90c5f..fe0b59495 100644 --- a/docs/queries/realtimeget-query.md +++ b/docs/queries/realtimeget-query.md @@ -35,8 +35,10 @@ Example require(__DIR__.'/init.php'); htmlHeader(); +// ... + // create a client instance -$client = new Solarium\Client($config); +$client = new Solarium\Client($adapter, $eventDispatcher, $config); // get an update query instance $update = $client->createUpdate(); diff --git a/docs/queries/select-query/building-a-select-query/adding-filterqueries.md b/docs/queries/select-query/building-a-select-query/adding-filterqueries.md index 3814bec2d..deaf4e918 100644 --- a/docs/queries/select-query/building-a-select-query/adding-filterqueries.md +++ b/docs/queries/select-query/building-a-select-query/adding-filterqueries.md @@ -21,8 +21,10 @@ Examples require(__DIR__.'/init.php'); htmlHeader(); +// ... + // create a client instance -$client = new Solarium\Client($config); +$client = new Solarium\Client($adapter, $eventDispatcher, $config); // get a select query instance $query = $client->createSelect(); diff --git a/docs/queries/select-query/building-a-select-query/building-a-select-query.md b/docs/queries/select-query/building-a-select-query/building-a-select-query.md index ad017591b..84654b9ba 100644 --- a/docs/queries/select-query/building-a-select-query/building-a-select-query.md +++ b/docs/queries/select-query/building-a-select-query/building-a-select-query.md @@ -35,8 +35,10 @@ require(__DIR__.'/init.php'); htmlHeader(); +// ... + // create a client instance -$client = new Solarium\Client($config); +$client = new Solarium\Client($adapter, $eventDispatcher, $config); // get a select query instance $query = $client->createSelect(); @@ -117,8 +119,10 @@ $select = array( ), ); +// ... + // create a client instance -$client = new Solarium\Client($config); +$client = new Solarium\Client($adapter, $eventDispatcher, $config); // get a select query instance based on the config $query = $client->createSelect($select); diff --git a/docs/queries/select-query/building-a-select-query/components/debug-component.md b/docs/queries/select-query/building-a-select-query/components/debug-component.md index 717fd4eb5..98627a864 100644 --- a/docs/queries/select-query/building-a-select-query/components/debug-component.md +++ b/docs/queries/select-query/building-a-select-query/components/debug-component.md @@ -17,8 +17,10 @@ Example require(__DIR__.'/init.php'); htmlHeader(); +// ... + // create a client instance -$client = new Solarium\Client($config); +$client = new Solarium\Client($adapter, $eventDispatcher, $config); // get a select query instance $query = $client->createSelect(); diff --git a/docs/queries/select-query/building-a-select-query/components/dismax-component.md b/docs/queries/select-query/building-a-select-query/components/dismax-component.md index 1d605d576..c440e4102 100644 --- a/docs/queries/select-query/building-a-select-query/components/dismax-component.md +++ b/docs/queries/select-query/building-a-select-query/components/dismax-component.md @@ -32,8 +32,10 @@ Example require(__DIR__.'/init.php'); htmlHeader(); +// ... + // create a client instance -$client = new Solarium\Client($config); +$client = new Solarium\Client($adapter, $eventDispatcher, $config); // get a select query instance $query = $client->createSelect(); diff --git a/docs/queries/select-query/building-a-select-query/components/distributed-search-component.md b/docs/queries/select-query/building-a-select-query/components/distributed-search-component.md index 951e3aa87..775616f4a 100644 --- a/docs/queries/select-query/building-a-select-query/components/distributed-search-component.md +++ b/docs/queries/select-query/building-a-select-query/components/distributed-search-component.md @@ -20,8 +20,10 @@ Example require(__DIR__.'/init.php'); htmlHeader(); +// ... + // create a client instance -$client = new Solarium\Client($config); +$client = new Solarium\Client($adapter, $eventDispatcher, $config); // get a select query instance $query = $client->createSelect(); diff --git a/docs/queries/select-query/building-a-select-query/components/edismax-component.md b/docs/queries/select-query/building-a-select-query/components/edismax-component.md index 0a50929e2..bb44a9769 100644 --- a/docs/queries/select-query/building-a-select-query/components/edismax-component.md +++ b/docs/queries/select-query/building-a-select-query/components/edismax-component.md @@ -31,8 +31,10 @@ Example require(__DIR__.'/init.php'); htmlHeader(); +// ... + // create a client instance -$client = new Solarium\Client($config); +$client = new Solarium\Client($adapter, $eventDispatcher, $config); // get a select query instance $query = $client->createSelect(); diff --git a/docs/queries/select-query/building-a-select-query/components/facetset-component/facet-field.md b/docs/queries/select-query/building-a-select-query/components/facetset-component/facet-field.md index 61c0621b8..6e1ea9849 100644 --- a/docs/queries/select-query/building-a-select-query/components/facetset-component/facet-field.md +++ b/docs/queries/select-query/building-a-select-query/components/facetset-component/facet-field.md @@ -30,8 +30,10 @@ Example require(__DIR__.'/init.php'); htmlHeader(); +// ... + // create a client instance -$client = new Solarium\Client($config); +$client = new Solarium\Client($adapter, $eventDispatcher, $config); // get a select query instance $query = $client->createSelect(); diff --git a/docs/queries/select-query/building-a-select-query/components/facetset-component/facet-multiquery.md b/docs/queries/select-query/building-a-select-query/components/facetset-component/facet-multiquery.md index f14446ebb..b6378ff77 100644 --- a/docs/queries/select-query/building-a-select-query/components/facetset-component/facet-multiquery.md +++ b/docs/queries/select-query/building-a-select-query/components/facetset-component/facet-multiquery.md @@ -15,8 +15,10 @@ Example require(__DIR__.'/init.php'); htmlHeader(); +// ... + // create a client instance -$client = new Solarium\Client($config); +$client = new Solarium\Client($adapter, $eventDispatcher, $config); // get a select query instance $query = $client->createSelect(); diff --git a/docs/queries/select-query/building-a-select-query/components/facetset-component/facet-pivot.md b/docs/queries/select-query/building-a-select-query/components/facetset-component/facet-pivot.md index 0cbfca86e..0e6d8c6fd 100644 --- a/docs/queries/select-query/building-a-select-query/components/facetset-component/facet-pivot.md +++ b/docs/queries/select-query/building-a-select-query/components/facetset-component/facet-pivot.md @@ -22,8 +22,10 @@ Example require(__DIR__.'/init.php'); htmlHeader(); +// ... + // create a client instance -$client = new Solarium\Client($config); +$client = new Solarium\Client($adapter, $eventDispatcher, $config); // get a select query instance $query = $client->createSelect(); diff --git a/docs/queries/select-query/building-a-select-query/components/facetset-component/facet-query.md b/docs/queries/select-query/building-a-select-query/components/facetset-component/facet-query.md index 929e01d1f..4e9a8b9df 100644 --- a/docs/queries/select-query/building-a-select-query/components/facetset-component/facet-query.md +++ b/docs/queries/select-query/building-a-select-query/components/facetset-component/facet-query.md @@ -21,8 +21,10 @@ Example require(__DIR__.'/init.php'); htmlHeader(); +// ... + // create a client instance -$client = new Solarium\Client($config); +$client = new Solarium\Client($adapter, $eventDispatcher, $config); // get a select query instance $query = $client->createSelect(); diff --git a/docs/queries/select-query/building-a-select-query/components/facetset-component/facet-range.md b/docs/queries/select-query/building-a-select-query/components/facetset-component/facet-range.md index a9cc03286..e1aa0222f 100644 --- a/docs/queries/select-query/building-a-select-query/components/facetset-component/facet-range.md +++ b/docs/queries/select-query/building-a-select-query/components/facetset-component/facet-range.md @@ -29,8 +29,10 @@ Examples require(__DIR__.'/init.php'); htmlHeader(); +// ... + // create a client instance -$client = new Solarium\Client($config); +$client = new Solarium\Client($adapter, $eventDispatcher, $config); // get a select query instance $query = $client->createSelect(); @@ -79,8 +81,10 @@ or when specifying pivot fields: require(__DIR__.'/init.php'); htmlHeader(); +// ... + // create a client instance -$client = new Solarium\Client($config); +$client = new Solarium\Client($adapter, $eventDispatcher, $config); // get a select query instance $query = $client->createSelect(); @@ -116,4 +120,4 @@ foreach ($facets as $facet) { htmlFooter(); -``` \ No newline at end of file +``` diff --git a/docs/queries/select-query/building-a-select-query/components/grouping-component.md b/docs/queries/select-query/building-a-select-query/components/grouping-component.md index e8bed30cd..bea0b0cd7 100644 --- a/docs/queries/select-query/building-a-select-query/components/grouping-component.md +++ b/docs/queries/select-query/building-a-select-query/components/grouping-component.md @@ -32,8 +32,10 @@ Grouping by field: require(__DIR__.'/init.php'); htmlHeader(); +// ... + // create a client instance -$client = new Solarium\Client($config); +$client = new Solarium\Client($adapter, $eventDispatcher, $config); // get a select query instance $query = $client->createSelect(); @@ -92,8 +94,10 @@ Grouping by query: require(__DIR__.'/init.php'); htmlHeader(); +// ... + // create a client instance -$client = new Solarium\Client($config); +$client = new Solarium\Client($adapter, $eventDispatcher, $config); // get a select query instance $query = $client->createSelect(); diff --git a/docs/queries/select-query/building-a-select-query/components/highlighting-component.md b/docs/queries/select-query/building-a-select-query/components/highlighting-component.md index 2195990f1..6b1f40c92 100644 --- a/docs/queries/select-query/building-a-select-query/components/highlighting-component.md +++ b/docs/queries/select-query/building-a-select-query/components/highlighting-component.md @@ -48,8 +48,10 @@ Example require(__DIR__.'/init.php'); htmlHeader(); +// ... + // create a client instance -$client = new Solarium\Client($config); +$client = new Solarium\Client($adapter, $eventDispatcher, $config); // get a select query instance $query = $client->createSelect(); @@ -106,8 +108,10 @@ Per-field settings: require(__DIR__.'/init.php'); htmlHeader(); +// ... + // create a client instance -$client = new Solarium\Client($config); +$client = new Solarium\Client($adapter, $eventDispatcher, $config); // get a select query instance $query = $client->createSelect(); diff --git a/docs/queries/select-query/building-a-select-query/components/morelikethis-component.md b/docs/queries/select-query/building-a-select-query/components/morelikethis-component.md index 973d885ee..53d218475 100644 --- a/docs/queries/select-query/building-a-select-query/components/morelikethis-component.md +++ b/docs/queries/select-query/building-a-select-query/components/morelikethis-component.md @@ -26,8 +26,10 @@ Example require(__DIR__.'/init.php'); htmlHeader(); +// ... + // create a client instance -$client = new Solarium\Client($config); +$client = new Solarium\Client($adapter, $eventDispatcher, $config); // get a select query instance $query = $client->createSelect(); diff --git a/docs/queries/select-query/building-a-select-query/components/query-elevation-component.md b/docs/queries/select-query/building-a-select-query/components/query-elevation-component.md index c73a2cb9a..4f1650a59 100644 --- a/docs/queries/select-query/building-a-select-query/components/query-elevation-component.md +++ b/docs/queries/select-query/building-a-select-query/components/query-elevation-component.md @@ -24,8 +24,10 @@ Example require(__DIR__.'/init.php'); htmlHeader(); +// ... + // create a client instance -$client = new Solarium\Client($config); +$client = new Solarium\Client($adapter, $eventDispatcher, $config); // get a select query instance $query = $client->createSelect(); diff --git a/docs/queries/select-query/building-a-select-query/components/query-rerankquery-component.md b/docs/queries/select-query/building-a-select-query/components/query-rerankquery-component.md index 3d6f317ec..525fa1417 100644 --- a/docs/queries/select-query/building-a-select-query/components/query-rerankquery-component.md +++ b/docs/queries/select-query/building-a-select-query/components/query-rerankquery-component.md @@ -23,8 +23,10 @@ Example require(__DIR__.'/init.php'); htmlHeader(); +// ... + // create a client instance -$client = new Solarium\Client($config); +$client = new Solarium\Client($adapter, $eventDispatcher, $config); // get a select query instance $query = $client->createSelect(); diff --git a/docs/queries/select-query/building-a-select-query/components/spellcheck-component.md b/docs/queries/select-query/building-a-select-query/components/spellcheck-component.md index ebf0e9988..03ea8fd46 100644 --- a/docs/queries/select-query/building-a-select-query/components/spellcheck-component.md +++ b/docs/queries/select-query/building-a-select-query/components/spellcheck-component.md @@ -36,8 +36,10 @@ Example require(__DIR__.'/init.php'); htmlHeader(); +// ... + // create a client instance -$client = new Solarium\Client($config); +$client = new Solarium\Client($adapter, $eventDispatcher, $config); // get a select query instance $query = $client->createSelect(); diff --git a/docs/queries/select-query/building-a-select-query/components/stats-component.md b/docs/queries/select-query/building-a-select-query/components/stats-component.md index ea48f1d06..71ace9bde 100644 --- a/docs/queries/select-query/building-a-select-query/components/stats-component.md +++ b/docs/queries/select-query/building-a-select-query/components/stats-component.md @@ -18,8 +18,10 @@ Example require(__DIR__.'/init.php'); htmlHeader(); +// ... + // create a client instance -$client = new Solarium\Client($config); +$client = new Solarium\Client($adapter, $eventDispatcher, $config); // get a select query instance $query = $client->createSelect(); diff --git a/docs/queries/select-query/executing-a-select-query.md b/docs/queries/select-query/executing-a-select-query.md index e2090a9f9..423a8e0d6 100644 --- a/docs/queries/select-query/executing-a-select-query.md +++ b/docs/queries/select-query/executing-a-select-query.md @@ -8,8 +8,10 @@ See the example code below. require(__DIR__.'/init.php'); htmlHeader(); +// ... + // create a client instance -$client = new Solarium\Client($config); +$client = new Solarium\Client($adapter, $eventDispatcher, $config); // get a select query instance $query = $client->createQuery($client::QUERY_SELECT); diff --git a/docs/queries/select-query/result-of-a-select-query/component-results/facetset-result.md b/docs/queries/select-query/result-of-a-select-query/component-results/facetset-result.md index 5b2a25534..0e4b2b14a 100644 --- a/docs/queries/select-query/result-of-a-select-query/component-results/facetset-result.md +++ b/docs/queries/select-query/result-of-a-select-query/component-results/facetset-result.md @@ -17,8 +17,10 @@ You can also use the `Countable` interface to get the number of counts. require(__DIR__.'/init.php'); htmlHeader(); +// ... + // create a client instance -$client = new Solarium\Client($config); +$client = new Solarium\Client($adapter, $eventDispatcher, $config); // get a select query instance $query = $client->createSelect(); @@ -69,8 +71,10 @@ A facet query result is really simple. It has just one value: the count. You can require(__DIR__.'/init.php'); htmlHeader(); +// ... + // create a client instance -$client = new Solarium\Client($config); +$client = new Solarium\Client($adapter, $eventDispatcher, $config); // get a select query instance $query = $client->createSelect(); @@ -118,8 +122,10 @@ A multiquery facet is basically a combination of multiple facet query instances. require(__DIR__.'/init.php'); htmlHeader(); +// ... + // create a client instance -$client = new Solarium\Client($config); +$client = new Solarium\Client($adapter, $eventDispatcher, $config); // get a select query instance $query = $client->createSelect(); @@ -174,8 +180,10 @@ A range facet is also similar to a facet field, but instead of field value count require(__DIR__.'/init.php'); htmlHeader(); +// ... + // create a client instance -$client = new Solarium\Client($config); +$client = new Solarium\Client($adapter, $eventDispatcher, $config); // get a select query instance $query = $client->createSelect(); diff --git a/docs/queries/select-query/result-of-a-select-query/component-results/grouping-result.md b/docs/queries/select-query/result-of-a-select-query/component-results/grouping-result.md index df8e66d9e..060411499 100644 --- a/docs/queries/select-query/result-of-a-select-query/component-results/grouping-result.md +++ b/docs/queries/select-query/result-of-a-select-query/component-results/grouping-result.md @@ -19,8 +19,10 @@ Grouped by field: require(__DIR__.'/init.php'); htmlHeader(); +// ... + // create a client instance -$client = new Solarium\Client($config); +$client = new Solarium\Client($adapter, $eventDispatcher, $config); // get a select query instance $query = $client->createSelect(); @@ -79,8 +81,10 @@ Grouped by query: require(__DIR__.'/init.php'); htmlHeader(); +// ... + // create a client instance -$client = new Solarium\Client($config); +$client = new Solarium\Client($adapter, $eventDispatcher, $config); // get a select query instance $query = $client->createSelect(); diff --git a/docs/queries/select-query/result-of-a-select-query/component-results/highlighting-result.md b/docs/queries/select-query/result-of-a-select-query/component-results/highlighting-result.md index 3c8030be0..3d2b0c5ed 100644 --- a/docs/queries/select-query/result-of-a-select-query/component-results/highlighting-result.md +++ b/docs/queries/select-query/result-of-a-select-query/component-results/highlighting-result.md @@ -11,8 +11,10 @@ Example require(__DIR__.'/init.php'); htmlHeader(); +// ... + // create a client instance -$client = new Solarium\Client($config); +$client = new Solarium\Client($adapter, $eventDispatcher, $config); // get a select query instance $query = $client->createSelect(); diff --git a/docs/queries/select-query/result-of-a-select-query/component-results/morelikethis-result.md b/docs/queries/select-query/result-of-a-select-query/component-results/morelikethis-result.md index a4b711d17..57c1f1ec7 100644 --- a/docs/queries/select-query/result-of-a-select-query/component-results/morelikethis-result.md +++ b/docs/queries/select-query/result-of-a-select-query/component-results/morelikethis-result.md @@ -11,8 +11,10 @@ Example require(__DIR__.'/init.php'); htmlHeader(); +// ... + // create a client instance -$client = new Solarium\Client($config); +$client = new Solarium\Client($adapter, $eventDispatcher, $config); // get a select query instance $query = $client->createSelect(); diff --git a/docs/queries/select-query/result-of-a-select-query/result-of-a-select-query.md b/docs/queries/select-query/result-of-a-select-query/result-of-a-select-query.md index 3bd2b6f5e..a29f822e5 100644 --- a/docs/queries/select-query/result-of-a-select-query/result-of-a-select-query.md +++ b/docs/queries/select-query/result-of-a-select-query/result-of-a-select-query.md @@ -42,8 +42,10 @@ A basic usage example: require(__DIR__.'/init.php'); htmlHeader(); +// ... + // create a client instance -$client = new Solarium\Client($config); +$client = new Solarium\Client($adapter, $eventDispatcher, $config); // get a select query instance $query = $client->createQuery($client::QUERY_SELECT); diff --git a/docs/queries/server-query/core-admin-query.md b/docs/queries/server-query/core-admin-query.md index b8b4106b7..f8ab95bf2 100644 --- a/docs/queries/server-query/core-admin-query.md +++ b/docs/queries/server-query/core-admin-query.md @@ -13,8 +13,10 @@ The following example shows how your can build a core admin query that executes require(__DIR__.'/init.php'); htmlHeader(); +// ... + // create a client instance -$client = new Solarium\Client($config); +$client = new Solarium\Client($adapter, $eventDispatcher, $config); // create a core admin query $coreAdminQuery = $client->createCoreAdmin(); diff --git a/docs/queries/suggester-query.md b/docs/queries/suggester-query.md index fe5cdead0..86809f9ab 100644 --- a/docs/queries/suggester-query.md +++ b/docs/queries/suggester-query.md @@ -34,8 +34,10 @@ Example require(__DIR__.'/init.php'); htmlHeader(); +// ... + // create a client instance -$client = new Solarium\Client($config); +$client = new Solarium\Client($adapter, $eventDispatcher, $config); // get a suggester query instance $query = $client->createSuggester(); diff --git a/docs/queries/terms-query.md b/docs/queries/terms-query.md index 881c76c0e..908b90d9b 100644 --- a/docs/queries/terms-query.md +++ b/docs/queries/terms-query.md @@ -43,8 +43,10 @@ Example require(__DIR__.'/init.php'); htmlHeader(); +// ... + // create a client instance -$client = new Solarium\Client($config); +$client = new Solarium\Client($adapter, $eventDispatcher, $config); // get a terms query instance $query = $client->createTerms(); diff --git a/docs/queries/update-query/building-an-update-query/add-command.md b/docs/queries/update-query/building-an-update-query/add-command.md index 1957cf87a..8d22e5c53 100644 --- a/docs/queries/update-query/building-an-update-query/add-command.md +++ b/docs/queries/update-query/building-an-update-query/add-command.md @@ -30,8 +30,10 @@ Examples require(__DIR__.'/init.php'); htmlHeader(); +// ... + // create a client instance -$client = new Solarium\Client($config); +$client = new Solarium\Client($adapter, $eventDispatcher, $config); // get an update query instance $update = $client->createUpdate(); diff --git a/docs/queries/update-query/building-an-update-query/building-an-update-query.md b/docs/queries/update-query/building-an-update-query/building-an-update-query.md index 8185070a0..e11903e2c 100644 --- a/docs/queries/update-query/building-an-update-query/building-an-update-query.md +++ b/docs/queries/update-query/building-an-update-query/building-an-update-query.md @@ -37,8 +37,10 @@ Add documents: require(__DIR__.'/init.php'); htmlHeader(); +// ... + // create a client instance -$client = new Solarium\Client($config); +$client = new Solarium\Client($adapter, $eventDispatcher, $config); // get an update query instance $update = $client->createUpdate(); @@ -78,8 +80,10 @@ Delete by query: require(__DIR__.'/init.php'); htmlHeader(); +// ... + // create a client instance -$client = new Solarium\Client($config); +$client = new Solarium\Client($adapter, $eventDispatcher, $config); // get an update query instance $update = $client->createUpdate(); diff --git a/docs/queries/update-query/building-an-update-query/commit-command.md b/docs/queries/update-query/building-an-update-query/commit-command.md index e9a23c708..120034b40 100644 --- a/docs/queries/update-query/building-an-update-query/commit-command.md +++ b/docs/queries/update-query/building-an-update-query/commit-command.md @@ -28,8 +28,10 @@ Example require(__DIR__.'/init.php'); htmlHeader(); +// ... + // create a client instance -$client = new Solarium\Client($config); +$client = new Solarium\Client($adapter, $eventDispatcher, $config); // get an update query instance $update = $client->createUpdate(); diff --git a/docs/queries/update-query/building-an-update-query/delete-command.md b/docs/queries/update-query/building-an-update-query/delete-command.md index 773b9564e..47b18ae52 100644 --- a/docs/queries/update-query/building-an-update-query/delete-command.md +++ b/docs/queries/update-query/building-an-update-query/delete-command.md @@ -16,8 +16,10 @@ Examples require(__DIR__.'/init.php'); htmlHeader(); +// ... + // create a client instance -$client = new Solarium\Client($config); +$client = new Solarium\Client($adapter, $eventDispatcher, $config); // get an update query instance $update = $client->createUpdate(); @@ -43,8 +45,10 @@ htmlFooter(); require(__DIR__.'/init.php'); htmlHeader(); +// ... + // create a client instance -$client = new Solarium\Client($config); +$client = new Solarium\Client($adapter, $eventDispatcher, $config); // get an update query instance $update = $client->createUpdate(); diff --git a/docs/queries/update-query/building-an-update-query/optimize-command.md b/docs/queries/update-query/building-an-update-query/optimize-command.md index c3476f553..b1a508857 100644 --- a/docs/queries/update-query/building-an-update-query/optimize-command.md +++ b/docs/queries/update-query/building-an-update-query/optimize-command.md @@ -28,8 +28,10 @@ Example require(__DIR__.'/init.php'); htmlHeader(); +// ... + // create a client instance -$client = new Solarium\Client($config); +$client = new Solarium\Client($adapter, $eventDispatcher, $config); // get an update query instance $update = $client->createUpdate(); diff --git a/docs/queries/update-query/building-an-update-query/rollback-command.md b/docs/queries/update-query/building-an-update-query/rollback-command.md index 749db9797..fb8788654 100644 --- a/docs/queries/update-query/building-an-update-query/rollback-command.md +++ b/docs/queries/update-query/building-an-update-query/rollback-command.md @@ -16,8 +16,10 @@ Example require(__DIR__.'/init.php'); htmlHeader(); +// ... + // create a client instance -$client = new Solarium\Client($config); +$client = new Solarium\Client($adapter, $eventDispatcher, $config); // get an update query instance $update = $client->createUpdate(); diff --git a/docs/queries/update-query/executing-an-update-query.md b/docs/queries/update-query/executing-an-update-query.md index 66f67ca3b..1f5a75db3 100644 --- a/docs/queries/update-query/executing-an-update-query.md +++ b/docs/queries/update-query/executing-an-update-query.md @@ -8,8 +8,10 @@ See the example code below. require(__DIR__.'/init.php'); htmlHeader(); +// ... + // create a client instance -$client = new Solarium\Client($config); +$client = new Solarium\Client($adapter, $eventDispatcher, $config);; // get an update query instance $update = $client->createUpdate(); diff --git a/docs/solarium-concepts.md b/docs/solarium-concepts.md index 6389fbda2..ab19e5bfa 100644 --- a/docs/solarium-concepts.md +++ b/docs/solarium-concepts.md @@ -27,8 +27,10 @@ require(__DIR__.'/init.php'); htmlHeader(); +// ... + // create a client instance -$client = new Solarium\Client($config); +$client = new Solarium\Client($adapter, $eventDispatcher, $config); // get a select query instance $query = $client->createSelect(); @@ -107,8 +109,10 @@ $select = array( ), ); +// ... + // create a client instance -$client = new Solarium\Client($config); +$client = new Solarium\Client($adapter, $eventDispatcher, $config); // get a select query instance based on the config $query = $client->createSelect($select);