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
CommentFileSizeAuthor
#7 3361303.patch4.36 KBmkalkbrenner

Comments

ressa created an issue. See original summary.

ressa’s picture

Issue summary: View changes
mkalkbrenner’s picture

I basically agree, but we meed to be careful because there're some Solr services that have uncommon connection URLs.

ressa’s picture

Yes, 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.

mkalkbrenner’s picture

I 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.

mkalkbrenner’s picture

Once 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.

mkalkbrenner’s picture

Status: Active » Needs review
StatusFileSize
new4.36 KB

  • mkalkbrenner committed c1cd9027 on 4.x
    Issue #3361303 by mkalkbrenner, ressa: Make "Default Solr collection"...

  • mkalkbrenner committed 4778528d on 4.x
    Issue #3361303 by mkalkbrenner, ressa: Make "Default Solr collection"...
mkalkbrenner’s picture

Status: Needs review » Fixed
ressa’s picture

Thanks, 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:

Error message

Upload isn't possible! There's no default collection specified for this server. Edit this server and provide the default collection's name.

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:

Status message

Successfully uploaded configset solr_server_8ctud0.
Successfully created collection dev.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.