Tags:
create new tag
, view all tags

Feature Proposal: Optional case-insensitive sort on form fields for search results

Motivation

On a custom wikipedia-like wiki app, to show the topics in alphabetical order, we needed to sort on the defined term name, in a TWikiForm field, in a case-insensitive ways, as definitions of english terms and acronyms were used

Description and Documentation

I have added an optional "i" at the end of formfield, to be used as order="formfield(FIELD)i" to specify nocase sort

Examples

Impact and Available Solutions

Implementation

I attach a patch for Cairo (tested on latest Cairo) and for Dakar (tested on 4.1.2 & 4.0.4)

The "if" is external to the sort loop so normal sorting is no slower. nocase sorting is however a bit slower than nocase one (we use "lc a cmp lc b" instead od "a cmp b")

Documentation should be updated

-- Contributors: ColasNahaboo

Discussion

-- ColasNahaboo - 13 Mar 2007

Useful enhancement. On syntax, I would not add something to the end after the parenthesis, I would align it with the existing syntax. Either:

  • with a comma delimited parameter, such as order="formfield(NAME, i)",
  • or with a new keyword, such as order="formfieldignorecase(NAME)"

The case sensitive sorting could also be generalized, e.g. not just for the formfield:

  • with a new parameter to turn on case insensitive sort, ordercaseinsensitive="on" order="formfield(NAME)
  • or with a new parameter to do case insensitive sort, ordercaseinsensitive="formfield(NAME)

-- PeterThoeny - 13 Mar 2007

Topic attachments
I Attachment History Action Size Date Who Comment
Unknown file formatdiff wiki-cairo-search-nocase-patch.diff r1 manage 2.2 K 2007-03-13 - 15:52 ColasNahaboo patch for Cairo
Unknown file formatdiff wiki-dakar-search-nocase-patch.diff r1 manage 3.6 K 2007-03-13 - 15:55 ColasNahaboo patch for lib/TWiki/Search.pm dakar v4.1.2 (works with 4.0x also)
Edit | Attach | Watch | Print version | History: r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r2 - 2007-03-13 - PeterThoeny
 
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2017 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.