Sammaye / yii2-solr

A Yii2 Solr Extension built ontop of Solarium
10 stars 22 forks source link

Argument 1 passed to Solarium\Core\Client\Client::__construct() must be an instance of Solarium\Core\Client\Adapter\AdapterInterface, array given, called in C:\xampp\htdocs\yii-application\vendor\sammaye\yii2-solr\Client.php on line 17 #15

Closed danishaali9 closed 3 years ago

Sammaye commented 3 years ago

duplicate of https://github.com/Sammaye/yii2-solr/issues/15

danishaali9 commented 3 years ago

@Sammaye this is #15 what is its solution. can u please show me a path how to do it

Sammaye commented 3 years ago

I'm afraid I have not maintained this plugin in about 7 years, I don't even use Yii2 anymore

plazareff commented 3 years ago

Confronted to the same issue, I found a quick and dirty workaround.

Look at https://github.com/plazareff/yii2-solr/blob/master/Client.php

I'm using the Curl adapter, so it's fine as it is. You may want to adapt for other adapters.

I don't know if there's any change, but in the config/components array I entered the following :

'solr' => [ 'class' => 'sammaye\solr\Client', 'options' => [ 'endpoint' => [ 'solr1' => [ 'scheme' => 'http', # or https 'host' => '127.0.0.1', # works with ip but does not seem to resolve hostnames 'port' => 8983, 'path' => '/', 'core' => 'myColl', # replace core by collection for the cloud version ] ] ] ],

Sorry for the rough patch, hopes it helps...