For some reason, while we moved the datasource configuration into their own property on the index, we kept the processors inside the options array, making these a bit more awkward to handle. I think moving them to their own, dedicated property, too, would make sense.
We could also think about moving the fields configuration as well. Or is there a specific reason it should be in the options, other than that it was like that in D7 (and I didn't want countless serialized database columns back then – now not an issue anymore)?
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: 3
| Comment | File | Size | Author |
|---|---|---|---|
| #27 | 2317771-27--processors_and_fields_properties.patch | 37.58 KB | drunken monkey |
Comments
Comment #1
drunken monkeyComment #2
nick_vhComment #3
drunken monkeyWe should probably do this ASAP, to break as few installations as possible. (Since this will break all of them.)
Comment #4
drunken monkeyThe index should then also have setters for both that automatically sort the new settings. Currently, it seems that code is in the form submit handlers, where it of course doesn't belong.
Comment #5
drunken monkeyOK, not ASAP, apparently.
Anyways, since I'm again struggling with fields and (static) caching: we could then resolve the whole problem by just loading the field objects once for the index, having them as the canonical representation of the fields (basically) and forbidding any direct access to the actual, stored
$fieldsproperty, and then writing the field objects back to the stored property only when the index is saved.It seems to me this could resolve a huge load of caching troubles.
Comment #6
borisson_Comment #9
borisson_Comment #12
borisson_Going to move fields as well, will post work later today.
Comment #13
borisson_This patch should be green.
Comment #14
borisson_This still breaks in a 100 million ways, uploading as intermediate work.
Comment #17
borisson_go testbot, go!
Comment #20
borisson_Comment #21
borisson_Attached patch fixes some small issues I found with my own patch in #20. Those are some small documentation fixes.
I also made the
IntegrationTest::addFieldsToIndexa little bit more robust by adding some extra assertions, those aren't directly related to this patch and I can move them into a new issue if that's needed. I think it might be a good thing to add those assertions in more places where we're posting forms / making changes.+ $this->assertFieldChecked('edit-fields-entitynodetitle-indexed', 'title is saved');I will probably have another look at this patch tomorrow morning to see if I can find other nitpicks, but most of the work in the patch is find-replace work. The testsuite agrees with the work I did, I'm confident in the work done here.
Comment #22
drunken monkeyThanks for implementing this change!
However, I fear the timing isn't great, with #2574969: Add a Views-like UI for adding fields almost finished and changing a lot of the fields code, this is sure to require a lot of re-rolling work either way. I think committing the other one first and then re-rolling this one might be easier, but I'm not sure.
The patch itself looks of course mostly good, just two things:
getCachedFields()is a good new name for the method, the fact that they are cached should be mostly transparent to callers of the method, and in any case not have any effect on them. I proposegetFieldObjects()in the attached patch, but actually I think the solution from the processors makes more sense – using[gs]etFieldSettings()for the new methods and keepinggetFields()as-is. In any case, I don't see a reason why fields and processors would have different mechanisms there, this is just bound to lead to confusions.What would you say?
Comment #23
borisson_[gs]etFieldSettings()does make more sense. Let's implement that as well.But I agree, let's get #2574969: Add a Views-like UI for adding fields in first.
Comment #24
borisson_back to NW.
Comment #25
borisson_Postponing this on that.
Comment #26
borisson_Fixes #23. I redid everything in this patch again from scratch because of that change + the field UI commit.
Comment #27
drunken monkeyThanks for the re-roll (or, rather, redo)! Looks pretty good, just a few style issues, as usual. (Mostly adjusting method order to my taste.)
The exception when trying to access/change the old options is a pretty good idea. However, we should be sure to remove it before the stable release, I don't think such code should be present there. In the meantime it could help a few people, though.
Comment #28
borisson_That was left for my own debugging purposes to make sure I didn't forget converting anything. I think we can leave this in for the benefit of other modules for a while. Until beta release, probably. Let's create an issue about it as well.
Otherwise, happy with the changes.
Comment #29
drunken monkeyAs per our IRC discussion, removed the exceptions and committed.
Thanks again for all your work on this!
Comment #31
swentel commentedThis broke indexing of fields it seeems, see #2642534: processors shouldn't be unset in Index::__sleep, processorPlugins should be