> > if there is a way of sorting the search result of > 'YourSearchPlugin'? >
(see http://tiddlywiki.abego-software.de/#[[Sort%20YourSearch%20Result%20%28e.g.%20by%20date%29]]): *Sort YourSearch Result (e.g. by date) * The items in the YourSearch <javascript:;> result list are displayed in a "ranked" order, i.e. the best matches are listed first. If you want any other ordering (e.g. sort by date) you need to make the function abego.YourSearch.getRankFunction() return a different rank function function(tiddler, lastQuery). The number returned by the rankFunction defines the position of the given tiddler in the result. Higher numbers are displayed first. Tiddlers with same rank numbers are sorted by their titles (case sensitive). Example: Sort by titleAs tiddlers with the same rank number are sorted by their title you may use the following simple script to get the YourSearch<javascript:;>result alphabetically sorted: <script> var myZeroRankFunction = function(tiddler, lastQuery) { return 0; }; abego.YourSearch.getRankFunction = function() { return myZeroRankFunction; } </script> Example: Sort by dateFor a "sort by last modified date" ordering you may use this script: <script> var myDateRankFunction = function(tiddler, lastQuery) { return tiddler.modified.getTime(); }; abego.YourSearch.getRankFunction = function() { return myDateRankFunction; } </script> Use the Standard OrderingTo switch back to the standard ordering you may use this code use: <script> abego.YourSearch.getRankFunction = abego.YourSearch.getStandardRankFunction; </script> *(Note: there are no () behind the abego.YourSearch.getStandardRankFunction) * Switch between "Standard" and "By Date" OrderingWith just some few lines more you can use a checkbox to switch between "standard" and "by date" sorting. To define the checkbox add a line like the following in a tiddler (e.g. in AdvancedOptions <javascript:;>): <<option chkYourSearchSortByDate>> Sort 'Your Search' result by Date Sort 'Your Search' result by Date (Clicking the checkbox will affect the next query you type). And here the script that adjusts the ranking/sorting: <script> var myDateRankFunction = function(tiddler, lastQuery) { return tiddler.modified.getTime(); }; abego.YourSearch.getRankFunction = function() { return config.options.chkYourSearchSortByDate ? myDateRankFunction : abego.YourSearch.getStandardRankFunction(); } </script> On Wed, Jul 15, 2009 at 12:51 PM, wolfgang <wolfgangl...@gmail.com> wrote: > > Hi Udo, > > nice to see you posting again. > > However, I think the question here and in the thread linked to is > rather - if there is a way of sorting the search result of > 'YourSearchPlugin'? - and not with 'ForEachTiddlersPlugin'. > > best wishes.. > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "TiddlyWiki" group. To post to this group, send email to TiddlyWiki@googlegroups.com To unsubscribe from this group, send email to tiddlywiki+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/TiddlyWiki?hl=en -~----------~----~----~----~------~----~------~--~---