Currently, when adding new items for indexing in a processor or hook (cf. #2230917: Check if the post processing method at index time is powerful enough to support the multi document generation functionality as apachesolr had), this has to happen in the first processor(s), since otherwise those items' fields wouldn't be preprocessed by the other processors. Furthermore, when removing items to be indexed in a processor, we needlessly extract the items' fields beforehand.
All of these problems could be mitigated or solved by having an additional preprocessing step, before field extraction.
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 : 2
Story Points: 8
| Comment | File | Size | Author |
|---|---|---|---|
| #18 | search_api-preprocessIndexItems.patch | 505 bytes | mpp |
| #13 | 2230915-13--processor_alter_items_method.patch | 17.99 KB | drunken monkey |
| #11 | 2230915-11--processor_alter_items_method.patch | 17.84 KB | drunken monkey |
Comments
Comment #1
drunken monkeyClarified task. This is by no means one we have to implement soon (i.e., while still in the sandbox), though, I think.
Comment #2
drunken monkeyComment #3
drunken monkeyComment #4
nick_vhComment #5
drunken monkeyThis patch implements that and seems to work fine.
I'd also like to add some tests for this (and all other processor methods) to our
HooksTest, but this depends on #2752749: Make handling of index plugins/fields consistent and #2134803: Add a "processing level" setting to search queries to avoid conflicts.Comment #6
borisson_Only one thing I'd like to see changed, as well as the additional tests is the following:
@drunken monkey--
Comment #7
drunken monkey:(
That was already part of said tests, I just wanted to keep it for them.
See the attached patch.
Comment #9
drunken monkeyIs this already enough?
Comment #11
drunken monkeyA bit worrying that we didn't spot this config schema issue before – but then again, it's just in the test processor, so not really relevant.
And finally figured out what's wrong with the new hook test.
Comment #12
borisson_Lets rewrite this comment, I'd suggest:
Get all the extracted fields for the item.The fact that this is cached is an implementation of the method and shouldn't matter for this comment.If you disagree, than I feel this is RTBC, but setting back to NW for the comment update.
Comment #13
drunken monkeyThanks for your thorough review!
No, I disagree. If this didn't cache the field values, than calling this method here would be pointless and just a waste of ressources. Also, if the method didn't store the extracted values, processors wouldn't work, since the server would always receive newly extracted, unprocessed field values anyways. So it's not an implementation detail at all, it's a basic characteristic of the framework.
The patch needed a re-roll, but if tests pass I'll then treat it as RTBC, in accordance with your comment.
Comment #15
drunken monkeyCommitted.
Comment #16
mpp commentedThis is causing a fatal error ::preprocessIndexItems(array &$items) must be compatible with Drupal\search_api\Processor\ProcessorInterface::preprocessIndexItems(array $items)
See https://www.drupal.org/node/2230915
Comment #17
drunken monkeyIn which class, or which module? I'm positive we changed this in all our classes (and the tests would surely report it, otherwise) and we're not responsible for updating other modules.
Your link leads to this same issue.
Comment #18
mpp commentedSorry for the wrong copy paste but I still see it in
UnsavedIndexConfiguration:Comment #19
drunken monkeyAnd that produces actual fails anywhere on your site? As said in the other issue (I think), we currently don't use that class.