Does ParallelExecution omit PostBigRequest? #1014
-
Hi, I'm using the PostBigRequest plugin in my Solarium client which is working fine with my "miles long queries". But it looks like in combination with ParallelExecution the plugin gets omitted? The result after executing in parallel throws "Request URI too long". Is it possible to combine these two plugins? Thx & BR, |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 10 replies
This comment has been hidden.
This comment has been hidden.
-
Hi Alex, This has been fixed in Solarium 6.2.5. You can test it by modifying the ParallelExecution example. <?php
require_once(__DIR__.'/init.php');
htmlHeader();
// create a client instance and autoload the customize request plugin
$client = new Solarium\Client($adapter, $eventDispatcher, $config);
$parallel = $client->getPlugin('parallelexecution');
$client->getPlugin('postbigrequest');
// create two queries to execute
$queryInStock = $client->createSelect()->setQuery('inStock:true');
$queryLowPrice = $client->createSelect()->setQuery('price:[1 TO 30]');
// add a huge filterquery to create a very long query string
$fq = '-cat:'.str_repeat(implode('', range('a', 'z')), 1000);
$queryInStock->createFilterQuery('fq')->setQuery($fq);
$queryLowPrice->createFilterQuery('fq')->setQuery($fq);
// first execute the queries the normal way and time it
echo '<h1>Serial execution</h1>';
$start = microtime(true);
$resultInStock = $client->execute($queryInStock);
$resultLowPrice = $client->execute($queryLowPrice);
echo 'Execution time for normal "serial" execution of two queries: ' . round(microtime(true)-$start, 3) . ' s';
echo '<hr/>';
echo 'In stock: ' . $resultInStock->getNumFound() . '<br/>';
echo 'Low price: ' . $resultLowPrice->getNumFound() . '<br/>';
echo '<hr/>';
// now execute the two queries parallel and time it
echo '<h1>Parallel execution</h1>';
$start = microtime(true);
// keys for each query are important for fetching the results later!
$parallel->addQuery('instock', $queryInStock);
$parallel->addQuery('lowprice', $queryLowPrice);
$results = $parallel->execute();
echo 'Execution time for parallel execution of two queries: ' . round(microtime(true)-$start, 3) . ' s';
echo '<hr/>';
echo 'In stock: ' . $results['instock']->getNumFound() . '<br/>';
echo 'Low price: ' . $results['lowprice']->getNumFound() . '<br/>';
htmlFooter(); The order in which the plugins are registered doesn't matter. Regards, Thomas |
Beta Was this translation helpful? Give feedback.
-
Thank you very much, I will give it a try very soon. BR, |
Beta Was this translation helpful? Give feedback.
Hi Alex,
This has been fixed in Solarium 6.2.5.
You can test it by modifying the ParallelExecution example.