In #2317771: Move processor and/or field settings to top-level properties on the index?, 'processors' property was renamed to 'processorPlugins'. The problem is that when the config entity gets serialized and then deserialized, processors was empty becaused it's unset in __sleep() which is the wrong property to unset.

Original report.

Been going over this a couple of times, but it seems like the 'Rendered item' field doesn't index anything anymore.
When I look at the 'rendered_item' column in the index table, the value is always NULL and in the index_{field} table (in this case index_text) there isn't anything there. Happens on vanilla install with also the db defaults module as well (which suprised me a bit especially since I'm seeing tests that actually search, but maybe they are using different fields ?)

I know this has been working at some point, at least up and until 2015-11-30, somewhere after that it looks it got broken somehow, will try to dissect back to figure out which commit might have broken this - unless I'm doing something really stupid ?

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

swentel created an issue. See original summary.

swentel’s picture

Issue summary: View changes
borisson_’s picture

I've been look at this issue this morning. I can confirm that this doesn't work as expected.

swentel’s picture

swentel’s picture

search_api_language column also is NULL always as well (although that might be 'default' on a monolingual site, still, 'en' seems more appropriate here), so it's not only rendered_item.
Funky, enough, add the title as a field to index and that will work.

borisson_’s picture

This should "fix" the language and url fields. Rendered item is still a no-no for me, trying to figure that out.

swentel’s picture

I don't think this is the right fix, what I'm seeing is that $processor_settings is empty, fixing that will be the better trick here.

swentel’s picture

Status: Active » Needs review
FileSize
553 bytes

Welcome to serialization hell :)

(processors was renamed to processorPlugins which shouldn't be serialized)

swentel’s picture

hopefully one day fixed by #1977206: Default serialization of ConfigEntities in general

borisson_’s picture

Status: Needs review » Reviewed & tested by the community

Awesome. Adding a regression test for this would be perfect but I think we can probably add that as a followup and commit this one already.

There is no test for the batch anyway, as far as I can see.

The last submitted patch, 6: rendered_item_doesn_t-2642534-6.patch, failed testing.

The last submitted patch, 6: rendered_item_doesn_t-2642534-6.patch, failed testing.

swentel’s picture

Title: Rendered item doesn't seem to index anything » processorPlugins can not be serialized
Issue summary: View changes

Updating the issue title and summary

swentel’s picture

Title: processorPlugins can not be serialized » processors shouldn't be unset in Index::__sleep, processorPlugins should be

Even better title :)

borisson_’s picture

@swentel: We discussed in irc that we could add a unit test, is this what you had in mind?

borisson_’s picture

swentel’s picture

Status: Needs review » Reviewed & tested by the community

Woot - we discussed the name in IRC as well, in the end $serialized is probably ok, since that is what has happened to the object, so the patch in #15 is ok, great!

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 16: test-only.patch, failed testing.

The last submitted patch, 16: test-only.patch, failed testing.

swentel’s picture

Status: Needs work » Reviewed & tested by the community

Raah, stupid bot :)

drunken monkey’s picture

Thanks for finding and resolving this problem, that's really a bit silly. All the better that we'll now even get a test for that!

However, there were a few things still wrong with the patch (missing doc comments, "misspelled" "serialization" (coding standards demand American English)). I also think we can do things much simpler by just manually unserializing one of our existing index configs and testing with that – just with assertEquals(), not with checking properties one by one. That tests more with less code.

We should also add such a test for the server, and maybe even for other serializable objects (I'm thinking search queries, and maybe fields).

The last submitted patch, 21: 2642534-21--index_serialization--tests_only.patch, failed testing.

The last submitted patch, 21: 2642534-21--index_serialization--tests_only.patch, failed testing.

borisson_’s picture

Status: Needs review » Reviewed & tested by the community

We can add tests for query / server serialization later in another issue and get this fix in first.

drunken monkey’s picture

Status: Reviewed & tested by the community » Fixed

Sure, makes sense. Committed. Thanks again, both of you!
For the follow-up, see #2642814: Add tests for servers to EntitySerializationTest.

Status: Fixed » Closed (fixed)

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