0

How to change the core on the fly while querying in laravel solarium. Let suppose I have three cores and I want to call all three cores in laravel solarium.

ex: The below file is my config and controller file.

Config File :

return [
    'endpoint' => [
        'Collection' => [
            'host' => '192.168.0.1',
            'port' => '8983',
            'path' => '/solr',
            'core' => 'products'
        ],
    ]
];

controller construction initiate client object

// create a client instance
        $this->client = new \Solarium\Client();
        $this->endpoint =  $this->client->createEndpoint(Config::get('solr.endpoint.Collection'));

search function

$query = $this->client->createSelect();
$query->setQuery("*:*");
$resultset = $this->client->select($query, $this->endpoint);

Above code only one core product is defined but my requirement is to get the data from 3 another core so where I have to define all cores so I can get the data.

Muhammad Dyas Yaskur
  • 6,914
  • 10
  • 48
  • 73
  • Please show some effort by editing your question and explain what you're trying to achieve and what you've tried so far. Please take a minute to take the [tour](https://stackoverflow.com/tour) especially [how to ask](https://stackoverflow.com/help/how-to-ask). Thanks. – Muhammad Dyas Yaskur Dec 24 '19 at 06:50
  • Updated the effort. – Jeet Raj Sah Dec 24 '19 at 07:39
  • Could you refactor your `->client` reference to a `getClient()` method and instantiate a client with the proper collection set? – MatsLindh Dec 27 '19 at 08:28

0 Answers0