Currently, like in D7, we extract the item data for indexing into the typical huge arrays, with settings keys ($item[#something']
) used for passing the original object, datasource ID and item ID (and possibly other metadata later).
This should be switched to a proper OO implementation, using classed objects for each item, and for the fields contained within. The item object should have methods for retrieving the original object, datasource ID and item ID, as well as methods for getting/setting arbitrary metadata. Implementing Traversable
might also be a good idea.
We might also look at whether it makes sense for the item class (resp. its interface – both classes should of course also have interfaces) to inherit from ComplexDataInterface
, and the field class from TypedDataInterface
.
Comments
Comment #1
das-peter CreditAttribution: das-peter commentedComment #3
drunken monkeyJust a little reminder for everyone involved: while doing this, my fail in accounting for datasource-independent fields in
Index::indexItems()
(near the beginning of the method) should be fixed as well. Currently, tests for #2241429: Support translations are failing because they expose this error, but anyone trying to index anything with any datasource-independent field enabled will probably run into the same problem.Comment #4
das-peter CreditAttribution: das-peter commentedI'm not sure when I'm able to continue here - so unassigning me for now :|
Comment #5
drunken monkeyAh, let's just discuss this in #2253237: Add proper classes for indexed items and search results, splitting doesn't make sense if it's going to be one commit anyways.