DS search "group by type settings" not ordering by weight.

Events happening in the community are now at Drupal community events on www.drupal.org.
Posted by rogernyc on August 12, 2013 at 1:48pm

In DS 'displays >> search' in the 'group by type settings' area, setting the weight of the node-type groups is having no effect on the order of the groups in the search result display. They order by 'group label'. I've experimented with the weights, cleared the cache etc with no luck. Am I missing something?

Using DS 7.24, Weight 7.23, Drupal 7.22, Custom search 7.1.1

thanks!

Comments

Same issue here

Posted by codyzhao on April 7, 2014 at 11:52pm

Display suite: 7.x-2.6
Drupal: 7.26

No custom search installed, the weight is just not doing anything.

I'm seeing it too

Posted by mikemoretti on November 23, 2014 at 3:02am

And after looking at the module code, I know it's not sorting this stuff by weight at all but just inserting result groups in order of the results. I made a patch for this. I'll be opening a bug and submitting it there.

I can't attach the patch file here, but here is the text of it in case you have a hard time finding the bug report I post it to; this is based on v7.x-2.7:

*** sites/all/modules/ds/modules/ds_search/ds_search.module 2014年10月28日 03:47:46.000000000 -0400
--- ../ds_search.module 2014年11月22日 21:54:58.232102702 -0500


*** 311,316 ****
--- 311,323 ----
return theme('ds_search_page', $build);
}

  • function _ds_search_cmp_group_by_weights($a, $b) {
  • if ($a['#weight'] == $b['#weight']) {
  • return 0;
  • }
  • return ($a['#weight'] < $b['#weight']) ? -1 : 1;
  • }
  • /**
    • Helper function to group by type.
      */

*** 380,385 ****
--- 387,393 ----
$parity['ds-other'] = $parity['ds-other'] == 'odd' ? 'even' : 'odd';
}
}
+ uasort($build['search_results'], '_ds_search_cmp_group_by_weights');
}

/**

-Mike

Merci, Mike :-) Your code is

Posted by steveoriol on August 8, 2015 at 10:57am

Merci, Mike :-)
Your code is working for me as well, on Display Suite Search (ds_search) Version : 7.x-2.11
Cool !

Display Suite

Group organizers

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds:

AltStyle によって変換されたページ (->オリジナル) /