Alrighty, I've ended up feeling a bit of a fool as a result of my last couple of issues so I'm going to start with the disclaimer that I'm probably wrong about this!
That said, I'm going to try to be as detailed as possible to see if anyone else can reproduce this.

Right, so I've been experimenting with the views integration and I've come across a bit of a problem with the exposed sorts.

I've created a pretty basic view based on a solr node index.

The index has the date created indexed as a date and the one taxonomy vocab that I have for it is indexed as a string (the term reference field I'm using on the nodes is single-value, incidentally).
I've also got author, title, body and a few other simple fields indexed as well.

This view has the date created and the taxonomy term as exposed sorts.
If I swap between asc/desc for the 'default' sort (i.e. the top sort in the Views UI, the one that is pre-selected in the combo box when you first go to the view page) the sort works.
If, however, I select the second sort (and select either asc or desc) it still sorts on the top sort, with the selected sort being applied after the face.
So with the taxonomy as the top/default sort, if I select to sort by date then the results will be sorted by the taxonomy terms, with ties sorted by date created.

This is not the behaviour seen in regular views. With exposed sorts, the sort you select is the only one applied.
To test, you can create the equivalent regular view and see that whichever sort is selected will be the only one applied.

...Oh and I have a quick sort-related question that may-or-may not be a bug:
I have indexed Author >> Name indexed as a string. This isn't available as a click-sort in table views, but is available as a regular sort. Is this correct? I am particularly suspect as I saw that very field being used as a click-sort in your screencast.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

drunken monkey’s picture

No need for the disclaimer, you are apparently right about this. ;) I can reproduce the bug and will (hopefully) fix it shortly.

I have indexed Author >> Name indexed as a string. This isn't available as a click-sort in table views, but is available as a regular sort. Is this correct? I am particularly suspect as I saw that very field being used as a click-sort in your screencast.

No, this should definitely not be the case, and it does work for me. If the problem persists and you don't find any explanation, please file another issue.

drunken monkey’s picture

Status: Active » Needs review
FileSize
599 bytes

Attached is an ugly hack that should fix the problem.
It turns out that Views will always invoke all sort handlers, and then later reset them when an exposed sort is present. Since the resetting is done in a backend-specific way, though, this didn't work with the Search API backend.

Shadlington’s picture

That doesn't sounds particularly good... But that's a problem for views.
Anyway, the patch works! Thanks

drunken monkey’s picture

Status: Needs review » Fixed

OK, committed.

Status: Fixed » Closed (fixed)

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