ruflin/Elastica — pull request #375 by damienalexandre (2013-04-25 10:42:48+00:00)
Title: Add named key support to MultiSearch

This PR add ArrayAccess to `Elastica\Multi\ResultSet` and `Elastica\Multi\Search`,
allowing to specify a key for the searches, and getting it back with the results.

So when you do that:

$multiSearch = new MultiSearch($client);

$search1 = new Search($client);
$multiSearch->addSearch($search1, "search1");

$search2 = new Search($client);
$multiSearch->addSearch($search2, "search2");

Or this:

$multiSearch = new MultiSearch($client);

$search1 = new Search($client);
$search2 = new Search($client);
$search3 = new Search($client);

$multiSearch->setSearches(array('search1' => $search1, 'search2' => $search2, $search3));

You can get the searches AND their results with the same key:

$multiResultSet = $multiSearch->search();

$multiResultSet["search1"];
$multiResultSet["search2"];

The key is optional, the actual behavior (numeric index) is used if no key is provided.
This is very convenient because the actual MultiSearch does not:

- allow array access
- make sure than a ResultSet correspond to a Search without kacky stuff

I'm not sure about what to do with the tests,
I have added one test, and duplicated all the others from Elastica\Test\Multi\SearchTest with a "withKeys" suffix,
using key based searches and results. Everything is GREEN so I think there is no BC Break.