Steps to reproduce:
- You enable a fields processor, like "Stemmer". By default, it's enabled for all fulltext fields.
- You add a new fulltext field.
- The processor won't be enabled by default for that field.
It's not entirely clear what the correct behavior here should be, but I argue that in a lot of cases you'll want the enabled fields processors (that support that field) also enabled for a newly added field.
As a possible compromise, we could also think about only adding the field if the processor previously had all fields enabled – a bit more complex to implement, but less prone to surprises for site admins, I'd say. (Though, arguably, more complex behavior is harder to understand, being a potential UX problem on its own.)
Any opinions here?
(This issue was split off #2859683: Processors don't correctly preprocess keywords per field.)
Comment | File | Size | Author |
---|---|---|---|
#12 | 2867809-10--fields_processor_all_fields_option.patch | 13.98 KB | drunken monkey |
|
Comments
Comment #2
ShaunDychko CreditAttribution: ShaunDychko as a volunteer commentedThanks for looking into this issue. I was mired by it for a little while today.
How about adding a "select all fields" checkbox on a processor config, with a description below the checkbox saying "by selecting all, any new fields added to the index which are eligible for this processor will be automatically included in this processor." Choosing "select all fields" disables the checkboxes on each field, if that's conveniently possible. This simplifies a tiny bit the logic for checking whether a new field should be added to the processor automatically, since this will be done only if "select all" is chosen. It also gives site admins the ability to explicitly control this behaviour, and things will work the way they expect it to, one way or the other.
Comment #3
drunken monkeyAh, yes, that would be an option, too. Thanks for the suggestion!
I went ahead and implemented it, patch attached. Please test/review!
Comment #5
TuWebO CreditAttribution: TuWebO at Metadrop commentedHello,
Patch in #3 worked for me.
Converts to
Thanks!
Comment #6
drunken monkeyOK, good to hear it worked for you, too. Thanks for testing!
Then we just need to fix all those test failures …
Comment #8
drunken monkeyThat should do it.
Comment #9
borisson_I have some nits to pick, comments only. Not setting to needs work, because it's only comments.
I had to go to the
preIndexSave
method to have enough context for this comment, but I think we can improve this.Should we already open an issue for this (and link to it) or do we fix this in this issue?
We need to add pre-render callbacks to checkbox elements because form api doesn't add the default callbacks.
I think we should describe the test a little here.
Create a new mock for the Index, so we can override getFields method.
sounds better?
Comment #10
drunken monkeyThanks a lot once again for your thorough review!
You're right, some of these comments could definitely be improved.
Added #2881665: Get rid of "magic" isset() checks for field settings in FieldsProcessorPluginBase and referenced it in the
@todo
comment. It's an existing, separate issue, and not trivial (I think), so I wouldn't tackle that in this one.Are you really sure that's better? It seems more vague and not completely correct (Form API just doesn't add the default in this case, not generally).
Though I admit, the current comment also isn't perfect. Maybe like this?
Form API doesn't add the default "#pre_render" callbacks to an element if we set some of our own. We therefore need to explicitly include the default ones, too.
I now used this:
We want the option to make sure that all supported fields are automatically added to the processor, without adding unsupported ones or keeping old ones that were removed.
Sounds good?
Counter-offer:
Since it's not possible to override an already specified method on a mock object, we need to create a new mock object for the index in this test.
See the attached patch for my revisions.
Comment #11
borisson_The changes you suggested in the comments sound good, but it looks like you forgot the patch. Waiting for that before setting to rtbc.
Comment #12
drunken monkeyOops, sorry!
Comment #13
borisson_Looks great.
Comment #14
drunken monkeyGood to hear, thanks for reviewing!
Committed.
Thanks again, everyone!
Comment #16
drunken monkey