The $_GET param for the sort should be part of the facet links. Probably applies to D6 as well.

CommentFileSizeAuthor
#5 apachesolr_270604_retain_sort.patch2.18 KBpahariwalla

Comments

janusman’s picture

I think I already fixed this a month ago in #258626: Add "your current search" block! Right now handles solrsort and gids (Organic Groups) arguments... probably could/should autodetect any others and attach them to the links...

Changed functions in the patch:

  • theme_apachesolr_facet_item()
  • theme_apachesolr_unclick_link()
  • theme_apachesolr_sort_link()

New functions:

  • _apachesolr_remove_facet_link()
  • _apachesolr_url_query()
robertdouglass’s picture

This actually merits more thought. It would be easiy enough to put the sorts in the facet links. However, how do you unsort? If we had an explicit "score" sort this would allow you to go to the default sort (score), but otherwise you'd get into sort mode and never get out of it again.

janusman’s picture

It's not just going to be sorts: for example the OG support (in testing) also depends on extra query arguments... who knows what else will also use them.

Removing or adding a facet should not, IMO, destroy sort, as the user is not explicitly unsorting: he/she is clicking on a "add" or "remove facet" link, and is expecting just that =) A similar case is the Autofilter widget in Excel; filtering/unfiltering doesn't re-sort all your data...

I also think there is no "unsorted" listing in a Solr search, rather it is default-sorted by relevancy...

Hmm, I'd vote for the module to provide this:

  • in the Sort by block, explicitly show the "default" sort as "by relevancy", and let the user switch to that
  • let the admin decide what's the "un-sorting" (or "switch to default sorting") behaviour; personally, from user testing, I think users *expect* that ONLY typing in a new query *should* unsort, as they see it as 'starting over'.

Just my .02 =)

robertdouglass’s picture

Priority: Normal » Critical

Usability bug that I'd like to see fixed for 1.0 release.

pahariwalla’s picture

StatusFileSize
new2.18 KB

I no nothing about organic groups, but this simple-dimple patch (1 new line and 3 changed lines) at least retains the sort when clicking (or unclicking) on a facet.

I added a sortby option "Relevancy" so the user can get out of sort mode...

pahariwalla’s picture

Assigned: Unassigned » pahariwalla
Status: Active » Needs review
robertdouglass’s picture

This patch looks good to me. Looking for another reviewer to RTBC and/or commit.

JacobSingh’s picture

Status: Needs review » Fixed

Good work!
Fixed in Drupal-5 and Drupal-6.

Anonymous’s picture

Status: Fixed » Closed (fixed)

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