I checked and unchecked "Rendered item" option in Processor setting. I found that in search_api_page module

      $index = Index::load($this->index);

      $fields_info = $index->getFields();
      foreach ($index->getFulltextFields() as $field_id) {
        var_dump($field_id);
        $fields[$field_id] = $fields_info[$field_id]->getPrefixedLabel();
      }

always get string(16) "entity:node/body" string(17) "entity:node/title" string(13) "rendered_item" .

It will cause
Fatal error: Call to a member function getPrefixedLabel() on null in search_api_page/src/Entity/SearchApiPage.php on line 165.

Estimated Value and Story Points

This issue was identified as a Beta Blocker for Drupal 8. We sat down and figured out the value proposition and amount of work (story points) for this issue.

Value and Story points are in the scale of fibonacci. Our minimum is 1, our maximum is 21. The higher, the more value or work a certain issue has.

Value : 1
Story Points: 2

CommentFileSizeAuthor
#24 2612104-24--check_for_property_removal.patch16.13 KBdrunken monkey
#24 2612104-24--check_for_property_removal--interdiff.txt2.21 KBdrunken monkey
#22 2612104-22--check_for_property_removal.patch15.97 KBdrunken monkey
#22 2612104-22--check_for_property_removal--interdiff.txt3.16 KBdrunken monkey
#19 2612104-19--check_for_property_removal.patch12.85 KBdrunken monkey
#19 2612104-19--check_for_property_removal--interdiff.txt520 bytesdrunken monkey
#16 2612104-16--check_for_property_removal.patch12.85 KBdrunken monkey
#16 2612104-16--check_for_property_removal--interdiff.txt4.37 KBdrunken monkey
#10 2612104-10--check_for_property_removal.patch11.69 KBdrunken monkey
#10 2612104-10--check_for_property_removal--tests_only.patch4.23 KBdrunken monkey
#6 search_api-rendered_item_remove_uncheck.patch927 bytesAntonnavi
#3 search_api-rendered_item_remove_uncheck.patch971 bytesAntonnavi
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

shenzhuxi created an issue. See original summary.

Nick_vh’s picture

Issue summary: View changes
Issue tags: +beta blocker
Antonnavi’s picture

Got the same issue.
Fixed it with adding "rendered_item" field remove code to /src/Form/IndexProcessorsForm.php file submitForm() method, see attached patch.
Don't know is this correct way. If not correct - describe plz how better fix this issue.

Status: Needs review » Needs work

The last submitted patch, 3: search_api-rendered_item_remove_uncheck.patch, failed testing.

The last submitted patch, 3: search_api-rendered_item_remove_uncheck.patch, failed testing.

Antonnavi’s picture

Antonnavi’s picture

Status: Needs work » Needs review
andypost’s picture

Status: Needs review » Reviewed & tested by the community

works for me

drunken monkey’s picture

Title: Unchecking "Rendered item" option in Processor setting doesn't remove anything from $index->getFields() » Cascade properly when processors providing new properties are disabled
Status: Reviewed & tested by the community » Needs work
Related issues: +#2575003: Make adding new properties/fields more a first-class operation of processors

No, this is much too specialized. We need to deal with this in general: when a processor which provides new properties is removed, also remove all fields using those properties. Or, upon saving, ensure the underlying properties of all fields actually exist (probably better, since that would potentially catch more such situations – like #2724569: Improve handling of fields that no longer exist).

If we want to do this the former way, by dealing with processors, it should probably wait for #2575003: Make adding new properties/fields more a first-class operation of processors, though – which might actually solve this problem anyways. But, as said, probably it's smarter to just validate the fields' requirements/dependencies when saving the index.

drunken monkey’s picture

This should do it.

Had to remove the static caching for Index::getPropertyDefinitions(), though, since that concept was flawed – while we correctly reset the cache when adding/removing processors, changing the configuration of a processor or datasource can also already invalidate this cache. And since that now happens directl on that plugin object, it's not so easy to invalidate a static cache on the index in reaction to such a change.
All in all I felt this was too much hassle for something that probably won't really ever be an issue.
I also found some old code we still had in there relating to caches we don't even use anymor, and removed that, too.

The last submitted patch, 10: 2612104-10--check_for_property_removal--tests_only.patch, failed testing.

The last submitted patch, 10: 2612104-10--check_for_property_removal--tests_only.patch, failed testing.

Status: Needs review » Needs work

The last submitted patch, 10: 2612104-10--check_for_property_removal.patch, failed testing.

The last submitted patch, 10: 2612104-10--check_for_property_removal.patch, failed testing.

drunken monkey’s picture

Issue tags: +DevDaysMilan

Oh god, what happened there …

drunken monkey’s picture

Status: Needs review » Needs work

The last submitted patch, 16: 2612104-16--check_for_property_removal.patch, failed testing.

The last submitted patch, 16: 2612104-16--check_for_property_removal.patch, failed testing.

drunken monkey’s picture

Not a serious patch proposal, just checking whether this is the actual issue here.
Unfortunately, I'm on my laptop this week and tests are slow and broken there, so I can't really debug this properly this week.
If someone else wants to give it a try, that would be great. Otherwise it'll most likely have to wait a week or two.

Status: Needs review » Needs work

The last submitted patch, 19: 2612104-19--check_for_property_removal.patch, failed testing.

The last submitted patch, 19: 2612104-19--check_for_property_removal.patch, failed testing.

drunken monkey’s picture

The problem was that at the point the index is first saved the bundles whose fields the index uses haven't been created yet, so the index can't find the properties and subsequently removes the field (as it should).
The simplest solution I could come up with is this. (Change of parent class is unrelated, was just unnecessary baggage.) However, it's not very clean, so other suggestions are very welcome.

Status: Needs review » Needs work

The last submitted patch, 22: 2612104-22--check_for_property_removal.patch, failed testing.

drunken monkey’s picture

borisson_’s picture

Status: Needs review » Reviewed & tested by the community

So much tests for this, so great!

  • drunken monkey committed 921b616 on 8.x-1.x
    Issue #2612104 by drunken monkey, Antonnavi: Fixed left-over fields when...
drunken monkey’s picture

Status: Reviewed & tested by the community » Fixed

Thanks for reviewing!
Committed.

Status: Fixed » Closed (fixed)

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