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 someone answered one of your questions - please remember to edit the page and set the status to answered. The status selector is 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
ATasteOfTWiki PeterThoeny
2011-08-19T05:25:57Z
2011-08-19 - 05:25
AdministrationVariables PeterThoeny
2012-11-17T06:39:22Z
2012-11-17 - 06:39
AllowWebCreateByUserMappingManager PeterThoeny
2014-07-02T19:51:39Z
2014-07-02 - 19:51
AdminSkillsAssumptions PeterThoeny
2015-09-01T09:07:28Z
2015-09-01 - 09:07
AdminToolsCategory PeterThoeny
2018-01-30T17:20:15Z
2018-01-30 - 17:20

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 2015-09-01 - 09:07
AdminToolsCategory PeterThoeny 2018-01-30 - 17:20
AdministrationVariables PeterThoeny 2012-11-17 - 06:39
AllowWebCreateByUserMappingManager PeterThoeny 2014-07-02 - 19:51

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:
Edit | Attach | Watch | Print version | History: r4 < r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r4 - 2008-05-30 - FrederikBeun
 
  • 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-2026 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.