Problem/Motivation

HEAD is broken.

The demo test fails.

Proposed resolution

Let's fix it.

Comments

miro_dietiker created an issue. See original summary.

jmuzz’s picture

I ran the tests with several versions of search_api and found the commit that broke paragraphs_demo:

http://cgit.drupalcode.org/search_api/commit/?id=921b616

https://www.drupal.org/node/2612104

jmuzz’s picture

The tests will pass again after removing this specific change from src/Entity/Index.php in search_api.

@@ -1207,12 +1138,21 @@ public function preSave(EntityStorageInterface $storage) {
       'index_directly' => TRUE,
     );
 
-    // Remove all "locked" and "hidden" flags from all fields of the index. If
-    // they are still valid, they should be re-added by the processors.
     foreach ($this->getFields() as $field_id => $field) {
+      // Remove all "locked" and "hidden" flags from all fields of the index. If
+      // they are still valid, they should be re-added by the processors.
       $field->setIndexedLocked(FALSE);
       $field->setTypeLocked(FALSE);
       $field->setHidden(FALSE);
+
+      // Also check whether the underlying property actually (still) exists.
+      $datasource_id = $field->getDatasourceId();
+      if (!isset($properties[$datasource_id])) {
+        $properties[$datasource_id] = $this->getPropertyDefinitions($datasource_id);
+      }
+      if (!Utility::retrieveNestedProperty($properties[$datasource_id], $field->getPropertyPath())) {
+        $this->removeField($field_id);
+      }
     }
johnchque’s picture

Status: Active » Needs review
StatusFileSize
new1.04 KB

This seems to be working. :)

Status: Needs review » Needs work

The last submitted patch, 4: tests_broken_fix_head-2791315-3.patch, failed testing.

The last submitted patch, 4: tests_broken_fix_head-2791315-3.patch, failed testing.

jmuzz’s picture

Status: Needs work » Active

The config is ok I think. I was able to get the search working by doing a single import of the index config after the module was installed. The search fields are not getting imported with the rest of the search index settings during the install for some reason.

jmuzz’s picture

Status: Active » Needs work

Did not mean to change that.

The last submitted patch, 4: tests_broken_fix_head-2791315-3.patch, failed testing.

johnchque’s picture

I've been looking in the code of search_api, as far as I've seen the problem comes when preSaving the index, in the issue @jmuzz refers they add an extra if to check if the index of the current field is valid. I think this needs to be fixed in search_api.

miro_dietiker’s picture

I still can't see a reference to a search API issue that is pending and investigates this problem?

jmuzz’s picture

I don't think they knew about it. I created an issue in the search_api queue.

johnchque’s picture

Added related issue. Thanks @jmuzz

jmuzz’s picture

Status: Needs work » Needs review
StatusFileSize
new1.19 KB

Might be worth getting the tests passing even before that issue is fixed so testbot doesn't keep setting working patches to "Needs work".

The last submitted patch, 4: tests_broken_fix_head-2791315-3.patch, failed testing.

johnchque’s picture

yes, meanwhile we can do that.

  • miro_dietiker committed 10eba51 on 8.x-1.x authored by jmuzz
    Issue #2791315 by jmuzz, yongt9412: Tests broken - fix HEAD / Demo
    
miro_dietiker’s picture

fixed TODO to @todo following stds.

Committed. The demo tests shall indeed not block us from iterate on other issues.

miro_dietiker’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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