Feature Proposal: Search ordering on multiple fields

Motivation

Consider the situation where you order a table on, say, City. You might want to sub-order people that are in the same city by their name.

Description and Documentation

Add syntax for order parameter to SEARCH: formfield(field1,field2,..), with the intended semantics of ordering on field1 first, then on field2, etc..

Examples

%SEARCH{"foo" scope="topic" order="formfield(City),formfield(Name),date,author"}%

Impact

WhatDoesItAffect:

Implementation

Discussion

This was raised by SvenDowideit as Tasks.Item96. One possible issue: what about the reverse parameter to sort, which reverses the sort order? Does that need extending, what is the intended meaning when 'reverse="on"' when there are multiple fields?

-- KoenMartens - 08 Nov 2008 - 00:31

This could ride piggyback on GeneralSortingMechanism.

The 2 proposed libs are a little more complex. Not all fields are alphabetical, so they have the option to assign a sort key and type for each field. Something like this: field1=alpha, field2=int.

It would be good to start thinking here on the user interface of that code, and use the actual sorting lib hidden in Search,pm.

-- ArthurClemens - 08 Nov 2008 - 01:22

changed the propsed spec to be comma separated fields - so that its not presuming that is a couple of formfields. Also, that might allow formfield(Something)=reverseint,formfield(other)=date as Arthur suggests.

the reverse='on' setting would invert the final order that was calulated by the sort smile

Its all interconnected to the work I mooted in the Format and Search refactoring - and Arthur has jumpstarted.

-- SvenDowideit - 12 Nov 2008 - 11:33
Topic revision: r5 - 14 Mar 2011, GeorgeClark
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy