I have a view (style is table) and I can't get a default sort or click sorting to work, is there something I need to do?

CommentFileSizeAuthor
#3 1320374-apachesolr_views-click_sorting.patch837 bytesbecw

Comments

niyas’s picture

Hello,

In views table settings, you should find an option as "sortable" for all fields which you have displayed in table.

Check it out!

Thanks.

modstore’s picture

Yep, sortable is selected for each field. I click one of the table headers and it re-loads but sorting doesn't change.

becw’s picture

Category: support » bug
Status: Active » Needs review
StatusFileSize
new837 bytes

Click sorting is enabled for all fields in Apache Solr Views' hook_views_data() implementation, but isn't supported by the current field handler (apachesolr_views_handler_field): the Apache Solr Views query plugin uses apachesolr_views_query::add_sort() and the default views field handler applies click sorts using the ::add_orderby() method. The attached patch fixes this issue by implementing apachesolr_views_handler_field::click_sort() and calling the add_sort() method instead.

This patch also allows an alternate Solr field to be used for click sorting--this works in tandem with my patch in #1408500: Views of non-default Apache Solr "environments" (patch).

I've found that not all fields sort logically; for example, the entity_id field does not sort, even when explicitly specifying the sort in the "Sort criteria" section of the view.

becw’s picture

Title: Sorting doesn't seem to work? » Click sorting on fields does not work (patch)
ygerasimov’s picture

Status: Needs review » Fixed

Committed. Thank you!

Status: Fixed » Closed (fixed)

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