The combine fields filter does not seem to recognize fields which use the field type text (plain, long). I can't understand why this is the case given that it works with plain text and text (formatted, long) fields.
I previously looked at the relevant code in core. The reason `text (plain, long)` doesn't work is that it is not clickSortable (https://api.drupal.org/api/drupal/core!modules!views!src!Plugin!views!fi...). According to that function a field should be consider clicksortable if it is not a multivalue field or the clicksortable definition of the field has not been set to FALSE. From what I can see the `text (plain, long)` field meets these conditions, so should be clicksortable. Haven’t been able to work out why it returns FALSE in line num 43 in `Combine.php`.
| Comment | File | Size | Author |
|---|---|---|---|
| #31 | 2695207-31.patch | 4.4 KB | biguzis |
| #25 | 2695207-25.patch | 4.37 KB | lendude |
| #13 | 2695207-13.patch | 4.31 KB | lendude |
| #13 | 2695207-13-TEST_ONLY.patch | 3.73 KB | lendude |
| #7 | text_plain_long-2695207-6-8.3.x.patch | 4.24 KB | finne |
Comments
Comment #2
nghai commentedHi @Begun,
This problem still persists in Drupal Core v8.1.8, did you find any alternative for this ?
Or anybody can tell if this problem is going to fix in Drupal8 next release ?
Comment #3
dawehnerThe best way would be for you to try out 8.2.x, but I kinda doubt someone tried to fix it.
Comment #4
lendudeThe real bug here seems to be that `text (plain, long)` is somehow not click sortable, this it not something specific to the combine field filter. The combine field filter just abuses that data, and in this case, the field data just supplies the wrong answer.
#2349465: Add an isComputed method to field handlers should fix this issue for the combine field filter, since it will then have it's own data to use, but this will not fix the fact that `text (plain, long)` fields are for some reason not click sortable.
Did some quick debugging but couldn't find the reason that the views definition for those fields have 'click sortable' set to false.
Comment #6
finneBugfix for clicksorting on long text fields. This patch allows for and tests clicksorting on long text field types.
By enabling clicksorting this also allows combined field filter to use long text fields.
Comment #7
finneAnd here's the 8.3.x patch.
As this is a bugfix this should be applied to 8.3.x also.
Comment #10
dawehnerThis looks great for me! It is also ways to expand the test coverage.
Comment #13
lendudeNeeded a reroll, adding the test only version to make sure i got the reroll right.
Comment #15
finnePatch looks good.
Comment #16
xjmThanks! It looks like this was moved from a different file in #2399931: Generic entity api field handler should live in views module not in field module and dates to "Add the Views 7.x-3.x branch" in contrib in 2009, so no clear reason for it to be this way. The one thing I thought of was that sorting on a longtext field maybe could be a slow query if the field is really long, but that's not a reason to hardcode this.
Will this affect what's in the saved config by default for the text fields?
Comment #17
xjmFor #16; the answer might be "No, it won't" in which case we can just mark it RTBC again.
That said, a small change record might be nice to let people know they can now sort on this type of column if they want.
Comment #18
xjmForgot to set the status to NR for #16 and the change record.
Comment #19
dawehnerI added the change record. I think the performance implications are valid, but you can already sort for those fields by adding a sort criteria.
The sorted yml looks like the following:
As you see in this example, there is some difference between in general sortable and unsortable fields. Given that we should actually update the configuration I guess, and set those fields to be "sortable: false"?
Comment #20
lendudeWhile looking writing an update for the info settings I found this: #2917814: Views table style info never gets updated when changing/adding fields
So currently writing an update path for this would be total overkill since these settings are always hopelessly outdated/incorrect. Do we want to do it anyway, because that would be the right thing to do?
@xjm about #16, yeah that occurred to me too, and I guess that might have been the reason this was originally introduced, but like you said "that's not a reason to hardcode this". Plenty of other ways to click yourself into a slow query using Views :)
Comment #21
lendudeOh and thanks for the CR @dawehner! Made some small tweaks to it
Comment #23
lendudeSetting this back to RTBC per @xjm in #17
Comment #25
lendudeNeeded a reroll.
Comment #26
dendrmx commentedPatch #6 helped me with textarea and Combine filter issue in Drupal 8.4.5
Thank you! Appreciate you help.
Comment #27
handkerchiefSame Problem here. 8.5.0
Comment #28
blake.thompson commentedPatch in #25 is working for me on 8.5.1
Comment #30
olivier.br commentedPatch in #25 is working for me on 8.5.6
Comment #31
biguzis commentedPatch for 8.6.3
Comment #33
lendudeThanks for the reroll! Back to RTBC, all feedback has been addressed.
Question about the upgrade path remains, but because of #2917814: Views table style info never gets updated when changing/adding fields we would be upgrading bogus information anyway, so I'm still saying there is no point, but let's see if others agree.
Comment #34
alexpottGiven #33 I think requiring an upgrading path is out-of-scope. But I don't think this is a bug as such.
Committed 4bbebca and pushed to 8.7.x. Thanks!
Credited @xjm and @dawehner for code reviews and issue management.
Comment #37
quietone commentedpublish change record