Tags:
search1Add my vote for this tag create new tag
, view all tags

Question

When using the Search command you have the possibility to add a parameter order. e.g. order="editby" but is there also a possibility to make the sort on different columns thus eg. first on "editby" and then on "modified"?

I tried several things but I could not find a solution

Is this possible?

Environment

TWiki version: TWikiRelease04x01x02
TWiki plugins: DefaultPlugin, EmptyPlugin, InterwikiPlugin
Server OS:  
Web server:  
Perl version:  
Client OS:  
Web Browser:  
Categories: Search

-- FrederikBeun - 27 May 2008

Answer

ALERT! If you answer a question - or have a question you asked answered by someone - please remember to edit the page and set the status to answered. The status is in a drop-down list below the edit box.

As far as I can tell, VarSEARCH will only allow one key. That documentation topic suggests using a formatted table sorted with TablePlugin's initsort, but that only supports one key too.

Hopefully someone else has a better way to do this, but here's a work-around: hide the secondary key in the same column as the primary key, so that a search on that column uses the combined key. If the secondary key is a date (as you requested), use $isodate to make the combined key sortable. You don't have to display the date in that form though (e.g., used $date below).

Here is a sort by column 2 then column 3:

Topic Last Editor Last Edited
AccessControl PeterThoeny
2006-02-04T06:19:05Z
2006-02-04 - 06:19
ATasteOfTWikiTemplate PeterThoeny
2006-04-02T06:08:43Z
2006-04-02 - 06:08
AccessKeys PeterThoeny
2010-05-31T06:23:16Z
2010-05-31 - 06:23
AdminDocumentationCategory PeterThoeny
2010-06-26T04:11:55Z
2010-06-26 - 04:11
AdminSkillsAssumptions PeterThoeny
2010-07-17T00:00:16Z
2010-07-17 - 00:00
ApacheConfigGenerator PeterThoeny
2011-06-16T20:29:11Z
2011-06-16 - 20:29
ATasteOfTWiki PeterThoeny
2011-08-19T05:25:57Z
2011-08-19 - 05:25
AnApplicationWithWikiForm PeterThoeny
2011-10-31T17:07:20Z
2011-10-31 - 17:07
AdminToolsCategory PeterThoeny
2011-11-01T07:51:14Z
2011-11-01 - 07:51

For comparison, here is a sort by column 2 only,

Topic Last Editor Last Edited
ATasteOfTWiki PeterThoeny 2011-08-19 - 05:25
ATasteOfTWikiTemplate PeterThoeny 2006-04-02 - 06:08
AccessControl PeterThoeny 2006-02-04 - 06:19
AccessKeys PeterThoeny 2010-05-31 - 06:23
AdminDocumentationCategory PeterThoeny 2010-06-26 - 04:11
AdminSkillsAssumptions PeterThoeny 2010-07-17 - 00:00
AdminToolsCategory PeterThoeny 2011-11-01 - 07:51
AnApplicationWithWikiForm PeterThoeny 2011-10-31 - 17:07
ApacheConfigGenerator PeterThoeny 2011-06-16 - 20:29

For bonus points, you could play around with the table format to make it look like a straight search result.

-- SeanCMorgan - 27 May 2008

Cool workaround Sean, thanks for sharing!

-- PeterThoeny - 28 May 2008

Good idea thanks, you helped me a lot

-- FrederikBeun - 30 May 2008

 
Change status to:
Topic revision: r4 - 2008-05-30 - FrederikBeun
 
Twitter Delicious Facebook Digg Google Bookmarks E-mail LinkedIn Reddit StumbleUpon    
  • Download TWiki
TWiki logo Powered by PerlIdeas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2012 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.