hotdog icon indicating copy to clipboard operation
hotdog copied to clipboard

Sort search results by fields

Open frsyuki opened this issue 5 years ago • 2 comments

Sorted result provides better visibility of the results. This is especially useful when display_search_tags option is set and search expression includes wildecards. If display_search_tags is set and search expression doesn't include wildecards, result doesn't change at all because sorting is stable-sort.

frsyuki avatar Aug 01 '19 18:08 frsyuki

Yes, by default, hotdog will not perform ordering of the result, unless there is some invocations of "order_by()" in the expression. I think sorting by default makes some sense, however, at the same time, sometime we might prefer to get the result in different ordering, that is the reason why the ordering fearure has been implemented as search expressions, IIRC.... Hmm. 🤔

https://github.com/yyuu/hotdog/blob/v1.20190725.0/lib/hotdog/expression/semantics.rb#L518-L519 https://github.com/yyuu/hotdog/blob/v1.20190725.0/lib/hotdog/expression/semantics.rb#L586-L600

yyuu avatar Aug 01 '19 21:08 yyuu

yes. please use this PR in anyways as you would like.

frsyuki avatar Aug 02 '19 05:08 frsyuki