Sorting by the value of a custom field in search results *numerically*

Hello,

It seems that the sorting by custom field in search results is always done
alphabetically.

For example sorting by CF that contains only integers in descending order:
4
3
2
11
1

Is there a way to sort search results by custom field numerically?

Landon Stewart :: lstewart@iweb.com
Lead Specialist, Abuse and Security Management
Spécialiste principal, gestion des abus et sécurité
http://iweb.com :: +1 (888) 909-4932

Hello,
It seems that the sorting by custom field in search results is always done
alphabetically.
For example sorting by CF that contains only integers in descending order:
4
3
2
11
1
Is there a way to sort search results by custom field numerically?

I use the attached patch for 4.2.3 (not very efficient, but it works).

Easter-eggs Spécialiste GNU/Linux
44-46 rue de l’Ouest - 75014 Paris - France - Métro Gaité
Phone: +33 (0) 1 43 35 00 37 - Fax: +33 (0) 1 43 35 00 76
mailto:elacour@easter-eggs.com - http://www.easter-eggs.com

cf-sort.patch (1.88 KB)

Hello,
It seems that the sorting by custom field in search results is always done
alphabetically.
For example sorting by CF that contains only integers in descending order:
4
3
2
11
1
Is there a way to sort search results by custom field numerically?

I use the attached patch for 4.2.3 (not very efficient, but it works).

I misread your email, my patch just fix sorting on CF edit pages, not in
search results.

Easter-eggs Spécialiste GNU/Linux
44-46 rue de l’Ouest - 75014 Paris - France - Métro Gaité
Phone: +33 (0) 1 43 35 00 37 - Fax: +33 (0) 1 43 35 00 76
mailto:elacour@easter-eggs.com - http://www.easter-eggs.com

This is because the custom field values are stored as varchar or text in the database.
I added a feature request (Login) for it.

On Mon, May 05, 2014 at 02:21:28PM +0200, Emmanuel Lacour wrote:

On Fri, May 02, 2014 at 01:52:06PM -0700, Landon Stewart wrote:

Hello,
It seems that the sorting by custom field in search results is always done
alphabetically.
For example sorting by CF that contains only integers in descending order:
4
3
2
11
1
Is there a way to sort search results by custom field numerically?

I use the attached patch for 4.2.3 (not very efficient, but it works).

I misread your email, my patch just fix sorting on CF edit pages, not in search results.

Easter-eggs Spécialiste GNU/Linux
44-46 rue de l’Ouest - 75014 Paris - France - Métro Gaité
Phone: +33 (0) 1 43 35 00 37 - Fax: +33 (0) 1 43 35 00 76
mailto:elacour@easter-eggs.com - http://www.easter-eggs.com
RT Training - Dallas May 20-21
http://bestpractical.com/training

Thanks for your replies guys. And thanks for adding that feature request
Brent (Login).On 2 May 2014 13:52, Landon Stewart lstewart@iweb.com wrote:

Hello,

It seems that the sorting by custom field in search results is always done
alphabetically.

For example sorting by CF that contains only integers in descending order:
4
3
2
11
1

Is there a way to sort search results by custom field numerically?


Landon Stewart :: lstewart@iweb.com
Lead Specialist, Abuse and Security Management
Spécialiste principal, gestion des abus et sécurité
http://iweb.com :: +1 (888) 909-4932

Landon Stewart :: lstewart@iweb.com
Lead Specialist, Abuse and Security Management
Spécialiste principal, gestion des abus et sécurité
http://iweb.com :: +1 (888) 909-4932