Setup
- Solr version: 8
- Drupal Core version: 10
- Search API version: 1.29
- Search API Solr version: 4.2.10
- Configured Solr Connector: Solr Cloud with Basic Auth
Issue
If you add a new Solr server with "Solr Cloud with Basic Auth" and don't fill out the "Default Solr collection" field, you get these error messages, after you click "Upload Configset":
Status message
Successfully uploaded configset solr_server_4t2xpx.Error message
Creating collection failed with error code 400: Solr HTTP error: OK (400) { "responseHeader":{ "status":400, "QTime":3}, "error":{ "metadata":[ "error-class","org.apache.solr.common.SolrException", "root-error-class","org.apache.solr.common.SolrException"], "msg":"Invalid collection: []. collection names must consist entirely of periods, underscores, hyphens, and alphanumerics as well not start with a hyphen", "code":400}}
The problem is caused by the empty "Default Solr collection" field. This is not clear, and it would be more user friendly to help users avoid this situation.
I see three options, where one or more of them are in play, or all of them:
- Fill it with a default value, such as
default_solr_collection - Make "Default Solr collection" a required field
- Refuse submitting if the user clicks "Upload Configset", and the field is empty
| Comment | File | Size | Author |
|---|---|---|---|
| #7 | 3361303.patch | 4.36 KB | mkalkbrenner |
Comments
Comment #2
ressaComment #3
mkalkbrennerI basically agree, but we meed to be careful because there're some Solr services that have uncommon connection URLs.
Comment #4
ressaYes, I agree. Let's be careful.
But are we being careful for an edge problem, which very few will run into, whereas most (all?) new Solr Drupal users will run into this, since the field by default is empty?
There are a lot of fields which are pre-filled in the form. How should someone just starting with Solr know that this field is required, if it isn't marked so?
From my perspective, it would be a big improvement, and save a lot of time, doing one of my three suggestions.
Right now, almost everyone will run into this, and needlessly spend 5-30 minutes researching it, until they figure out that filling out this single field is necessary.
Comment #5
mkalkbrennerI reviewed the code.
In Cloud Mode it is possible to have every Search API index associated to that Search API Server stored within its own Solr collection.
And depending on your setup, for example in combination with multi-site or read-only foreign Solr indexes (Solr Document Datasource) it might be necessary to leave the default collection empty.
We removed the required flag as part of #3066194: Some statistics lead to exceptions when using individual collections per index on the same server .
Now the question is, how could we improve the usability without breaking things.
Comment #6
mkalkbrennerOnce you added an index, you get the propper error message:
"Default collection isn't set. Ensure that the collections are properly set on the indexes in their advanced section od the Solr specific index options."
Unfortunately we don't have the Search API Index when you create the Search API Server.
Comment #7
mkalkbrennerComment #10
mkalkbrennerComment #11
ressaThanks, this works well.
If the "Default Solr collection" field is empty, I get an error message after clicking "Upload Configset", about Missing collection. Also there's no Submit button:
After I fill out the "Default Solr collection" field and try again, the Configset is uploaded as expected and the collection is created on the Solr server: