Using the search_api_solr_datasource sandbox module already works really well for searching through an arbitrary Solr index, not created with the config files (esp. schema) provided by this module.

However, it leads to a few notices being printed, which I think can be very easily avoided. With this patch, I don't see any notices anymore (at the moment).

Comments

drunken monkey created an issue. See original summary.

drunken monkey’s picture

Issue summary: View changes
StatusFileSize
new1.4 KB

Patch attached. As said, very simple changes, just a bit more defensive coding.

mkalkbrenner’s picture

Status: Active » Needs work
+++ b/src/SolrConnector/SolrConnectorPluginBase.php
@@ -420,7 +420,7 @@ public function getSchemaVersionString($reset = FALSE) {
   public function getSchemaVersion($reset = FALSE) {
     $parts = explode('-', $this->getSchemaVersionString($reset));
-    return $parts[1];
+    return isset($parts[1]) ? $parts[1] : '';
   }

Exploding any kind of version string coming from a different server might set $parts[1] and therefor mess up things.
I suggest to verify the schema string if it matches our pattern.
If not this function should return something like const FOREIGN_SCHEMA.

mkalkbrenner’s picture

It seems that it makes a lot of sense to clearly indicate that we discovered a foreign schema and to deal with it at various places.

mkalkbrenner’s picture

Version: 8.x-1.x-dev » 8.x-2.x-dev

the code in question is now part of the connector.

mkalkbrenner’s picture

Version: 8.x-2.x-dev » 8.x-3.x-dev
Status: Needs work » Closed (outdated)

There's a checkbox in the server settings to turn off the schema check.