1

I'm trying to create a view with table display based on Search API (database search) index, with column-sorting (column set as Sortable in the display settings). However, this option isn't available for my view fields, no matter if they are based on string or fulltext Search API fields. Is there anything I can do to enable this?

I'm using latest Drupal 8.7.x nad Search API 1.12

Edit:

It seems that availability of click-sorting is determined in \Drupal\search_api\Plugin\views\field\SearchApiFieldTrait::clickSortable method. The check inside that fails, because field definition array doesn't contain a search_api field key. So is there anything I can do to add it there?

BTW. th support for click-sorting was added in https://www.drupal.org/project/search_api/issues/2816979. There are some SOLR-related issues mentioned, but noting related to my use-case.

  • Do you have indexes created on those fields? – anoopjohn Nov 19 at 3:53
  • Yes, otherwise these fields wouldn't be available to the view, AFAIK. – Miloš Kroulík Nov 19 at 6:13
2

As it turned out, it was my stupid mistake - search index field can be added to views (as a views field) in 2 ways, with one of them having (Indexed field) appended to the field label.

When I added field with (Indexed field) appended, I can set that field a Sortable.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.