I'm trying to use Search_api_solr and search-api. I install the required modules and run the solr server and create a core. But when I'm trying to add a server to my drupal 8 site, an error appears Solarium\Exception\UnexpectedValueException: Neither collection nor core set. in Solarium\Core\Client\Endpoint->getBaseUri() (line 299 of /var/www/html/vendor/solarium/solarium/src/Core/Client/Endpoint.php).

I try to change the following block in Endpoint.php file to my data but it's not working.

protected $options = [
        'scheme' => 'http',
        'host' => 'xx.xx.xx.x',
        'port' => 8983,
        'path' => '/solr/',
        'collection' => null,
        'core' => 'my_core',
        'timeout' => 5,
        'leader' => false,

also, should the host include the http:// or only the ip address? However, I try all above with no luck. Any advice. Thanks in advance.

  • 1
    Did you create an index in the admin? Why are you editing code ? – Kevin Aug 11 '19 at 22:11
  • @kevin not yet. because when I read the Endpoint.php file, it includes localhost and null values, not my main values. I through that's causing the issue. – IDI Aug 11 '19 at 22:24
  • 1
    I don’t know what that file is. Read the README of those modules first. It’s configurable from the admin. – Kevin Aug 12 '19 at 1:38
  • 1
    Yes, you should never need to touch any file under the vendor folder. If you look at the README, you'll see you need to install Drupal-specific configuration files in your core before it can be used, I suspect that may be your problem. – Alfred Armstrong Aug 12 '19 at 10:45
  • @AlfredArmstrong thanks for replay. which README? Do you mean the search-api-solr README? yes I copy all files in /search_api_solr/solr-conf/7.x/ folder into solr-7.7.2/server/solr/my_core/conf – IDI Aug 12 '19 at 11:33

Collection is required in solr configuration. You'll need to create a collection you want to use for your site. Create using below command or by user interface of solr, then use the same name for the collection.

sudo su - solr -c "/opt/solr/bin/solr create -c COLLECTION_NAME -n data_driven_schema_configs" // Only for ubuntu

Replace COLLECTION_NAME with the name of your collection you want.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.