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`.

Comments

Begun created an issue. See original summary.

nghai’s picture

Hi @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 ?

dawehner’s picture

Or anybody can tell if this problem is going to fix in Drupal8 next release ?

The best way would be for you to try out 8.2.x, but I kinda doubt someone tried to fix it.

lendude’s picture

Title: Text (plain, long) field does not appear in combine fields filter » Text (plain, long) field is not click sortable and does not appear in combine fields filter
Version: 8.0.5 » 8.3.x-dev

The 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.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.0-alpha1 will be released the week of January 30, 2017, which means new developments and disruptive changes should now be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

finne’s picture

Component: views_ui.module » views.module
Status: Active » Needs review
StatusFileSize
new3.69 KB
new4.27 KB

Bugfix 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.

finne’s picture

StatusFileSize
new4.24 KB

And here's the 8.3.x patch.
As this is a bugfix this should be applied to 8.3.x also.

The last submitted patch, 6: text_plain_long-2695207-6-TEST_ONLY.patch, failed testing. View results

Status: Needs review » Needs work

The last submitted patch, 7: text_plain_long-2695207-6-8.3.x.patch, failed testing. View results

dawehner’s picture

Status: Needs work » Reviewed & tested by the community

This looks great for me! It is also ways to expand the test coverage.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 7: text_plain_long-2695207-6-8.3.x.patch, failed testing. View results

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.0-alpha1 will be released the week of July 31, 2017, which means new developments and disruptive changes should now be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

lendude’s picture

Status: Needs work » Needs review
StatusFileSize
new3.73 KB
new4.31 KB

Needed a reroll, adding the test only version to make sure i got the reroll right.

The last submitted patch, 13: 2695207-13-TEST_ONLY.patch, failed testing. View results

finne’s picture

Status: Needs review » Reviewed & tested by the community

Patch looks good.

xjm’s picture

Thanks! 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.

+++ b/core/modules/views/views.views.inc
@@ -592,9 +592,9 @@ function views_field_default_views_data(FieldStorageConfigInterface $field_stora
           $filter = 'boolean';
         }
         break;
-      case 'text':
+
       case 'blob':
-        // It does not make sense to sort by blob or text.
+        // It does not make sense to sort by blob.

Will this affect what's in the saved config by default for the text fields?

xjm’s picture

Issue tags: +Needs change record

For #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.

xjm’s picture

Status: Reviewed & tested by the community » Needs review

Forgot to set the status to NR for #16 and the change record.

dawehner’s picture

Issue tags: -Needs change record

I added the change record. I think the performance implications are valid, but you can already sort for those fields by adding a sort criteria.

Will this affect what's in the saved config by default for the text fields?

The sorted yml looks like the following:

          info:
            node_bulk_form:
              align: ''
              separator: ''
              empty_column: false
              responsive: ''
            title:
              sortable: true
              default_sort_order: asc
              align: ''
              separator: ''
              empty_column: false
              responsive: ''

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"?

lendude’s picture

While 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 :)

lendude’s picture

Oh and thanks for the CR @dawehner! Made some small tweaks to it

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.0-alpha1 will be released the week of January 17, 2018, which means new developments and disruptive changes should now be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

lendude’s picture

Status: Needs review » Reviewed & tested by the community

Setting this back to RTBC per @xjm in #17

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 13: 2695207-13.patch, failed testing. View results

lendude’s picture

Status: Needs work » Needs review
StatusFileSize
new4.37 KB

Needed a reroll.

dendrmx’s picture

Patch #6 helped me with textarea and Combine filter issue in Drupal 8.4.5
Thank you! Appreciate you help.

handkerchief’s picture

Same Problem here. 8.5.0

blake.thompson’s picture

Patch in #25 is working for me on 8.5.1

Version: 8.6.x-dev » 8.7.x-dev

Drupal 8.6.0-alpha1 will be released the week of July 16, 2018, which means new developments and disruptive changes should now be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

olivier.br’s picture

Patch in #25 is working for me on 8.5.6

biguzis’s picture

StatusFileSize
new4.4 KB

Patch for 8.6.3

The last submitted patch, 25: 2695207-25.patch, failed testing. View results

lendude’s picture

Status: Needs review » Reviewed & tested by the community

Thanks 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.

alexpott’s picture

Category: Bug report » Task
Status: Reviewed & tested by the community » Fixed

Given #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.

  • alexpott committed 4bbebca on 8.7.x
    Issue #2695207 by Lendude, finne, biguzis, dawehner, xjm: Text (plain,...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

quietone’s picture

publish change record