On 10/05/2007 03:48:14 PM, Monahon Peter B. - Peter.Monahon@USPTO.GOV wrote:
Earlier: "...[how to] empower MediaWiki (code / variables / MySQL?) to show articles titles in lists sorted by numeric value, not text value... ...now...(example): [[1800]] [[1801.1]] [[1801]] [[700]] ...Rather then the preferred: [[700]] [[1800]] [[1801]] [[1801.1]] ... Is this a MySQL database quirk, or something selectable in PHP, even if requiring an enhancement?..."
Considering this example at Wikipedia: http://en.wikipedia.org/w/index.php?title=Special:Categories&limit=500 ... # 1009 establishments (2 members) # 100 BC (6 members) ... ...I'd presume that no one has addressed the "sort by numeric value, not text value" challenge yet. Has anyone? Does anyone have any clue as to where this sorting alternative (numeric versus text) may be addressed? MySQL or PHP or ...? Anybody? Anybody?
Workers in the hyper-rational U.S. bureaucracy have to breath this stuff, the rest of us get to make fun of it from time to time.
Seriously, this is a common problem, just not in page titles. That is, trying to use numerals as text and wanting numeric sorts instead of dictionary sorts. But a general solution is hard. Part of the problem is that these are only semi-numbers, I bet you would be not be surprised to see "712.34.56". The usual way I deal with this is to use special knowledge of the scheme to expand these strings into a full representation. For example, in your scheme, convert 700 to 0700.0, etc. Now the titles will sort as you expect. To do this you need to know how many digits are allowed on both sides of the decimal point, which is hard to generalize. No one is surprised any more by a zip code such as 02139, but if the modified title is too strange, you could probably find a way to use the modified title only for sorting and let users see the titles the way they are used to. My guess is that sorting modified title strings would work better and be quicker for you to do than trying to build-in a special sorting exception.
Hope that helps,
Jim