[interchange] Fix sorting by properties in Swish search.
Stefan Hornburg <[email protected]>
| Newsgroups | gmane.comp.web.interchange.cvs |
|---|---|
| Message-ID | <[email protected]> |
commit 75d0c0efb14ca1c32add5fb465562f3be5ba4147 Author: Stefan Hornburg (Racke) <[email protected]> Date: Mon Oct 18 11:44:48 2010 +0200 Fix sorting by properties in Swish search. lib/Vend/Swish.pm | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-) --- diff --git a/lib/Vend/Swish.pm b/lib/Vend/Swish.pm index 9b45443..f4f654e 100644 --- a/lib/Vend/Swish.pm +++ b/lib/Vend/Swish.pm @@ -209,6 +209,14 @@ sub search { $search_string = join (' or ', map {"$search_field=$_"} @pats); } } + + if ($s->{mv_sort_field} and @{$s->{mv_sort_field}}) { + for my $sort_field (@{$s->{mv_sort_field}}) { + unless (grep {$_ eq $sort_field} @{$s->{mv_field_names}}) { + push @{$s->{mv_field_names}}, $sort_field; + } + } + } for (@{ $s->{'mv_field_names'} }) { unless (exists $fmap{$_}) {